bosun.org: bosun.org/models Index | Files

package models

import "bosun.org/models"

Index

Package Files

alertKey.go errors.go incidents.go silence.go

Variables

var ActionShortNames = map[string]ActionType{
    "Ack":          ActionAcknowledge,
    "Close":        ActionClose,
    "Forget":       ActionForget,
    "ForceClose":   ActionForceClose,
    "Purge":        ActionPurge,
    "Note":         ActionNote,
    "DelayedClose": ActionDelayedClose,
    "CancelClose":  ActionCancelClose,
}

ActionShortNames is a map of keys we use in config file (notifications mostly) to reference action types

type Action Uses

type Action struct {
    // These are available to users via the template language. Changes here
    // should be reflected in the documentation
    User       string
    Message    string
    Time       time.Time
    Type       ActionType
    Deadline   *time.Time `json:",omitempty"`
    Fullfilled bool
    Cancelled  bool
}

type ActionType Uses

type ActionType int // Available to users in templates, document changes in Bosun docs
const (
    ActionNone ActionType = iota
    ActionAcknowledge
    ActionClose
    ActionForget
    ActionForceClose
    ActionPurge
    ActionNote
    ActionDelayedClose
    ActionCancelClose
)

func (ActionType) HumanString Uses

func (a ActionType) HumanString() string

HumanString gives a better human readable form than the default stringer, which we can't change due to marshalling compatibility now

func (ActionType) MarshalJSON Uses

func (a ActionType) MarshalJSON() ([]byte, error)

func (ActionType) String Uses

func (a ActionType) String() string

func (*ActionType) UnmarshalJSON Uses

func (a *ActionType) UnmarshalJSON(b []byte) error

type AlertError Uses

type AlertError struct {
    FirstTime, LastTime time.Time
    Count               int
    Message             string
}

type AlertKey Uses

type AlertKey string

func NewAlertKey Uses

func NewAlertKey(name string, group opentsdb.TagSet) AlertKey

func ParseAlertKey Uses

func ParseAlertKey(a string) (ak AlertKey, err error)

func (AlertKey) Group Uses

func (a AlertKey) Group() opentsdb.TagSet

Group returns the tagset of this alert key. Will panic if a is not a valid AlertKey. OpenTSDB tag validation errors are ignored.

func (AlertKey) Name Uses

func (a AlertKey) Name() string

type AlertKeys Uses

type AlertKeys []AlertKey

func (AlertKeys) Len Uses

func (a AlertKeys) Len() int

func (AlertKeys) Less Uses

func (a AlertKeys) Less(i, j int) bool

func (AlertKeys) Swap Uses

func (a AlertKeys) Swap(i, j int)

type Attachment Uses

type Attachment struct {
    Data        []byte
    Filename    string
    ContentType string
}

type Computation Uses

type Computation struct {
    Text  string
    Value interface{}
}

type Computations Uses

type Computations []Computation

type Epoch Uses

type Epoch struct {
    time.Time
}

func (Epoch) MarshalJSON Uses

func (t Epoch) MarshalJSON() ([]byte, error)

func (*Epoch) UnmarshalJSON Uses

func (t *Epoch) UnmarshalJSON(b []byte) (err error)

type Event Uses

type Event struct {
    Warn, Crit  *Result `json:",omitempty"`
    Status      Status
    Time        time.Time
    Unevaluated bool
}

type EventsByTime Uses

type EventsByTime []Event

func (EventsByTime) Len Uses

func (a EventsByTime) Len() int

func (EventsByTime) Less Uses

func (a EventsByTime) Less(i, j int) bool

func (EventsByTime) Swap Uses

func (a EventsByTime) Swap(i, j int)

type Float Uses

type Float float64

custom float type to support json marshalling of NaN

func (Float) MarshalJSON Uses

func (m Float) MarshalJSON() ([]byte, error)

func (*Float) UnmarshalJSON Uses

func (m *Float) UnmarshalJSON(b []byte) error

type FuncType Uses

type FuncType int
const (
    TypeString FuncType = iota
    TypePrefix
    TypeScalar
    TypeNumberSet
    TypeSeriesSet
    TypeESQuery
    TypeESIndexer
    TypeNumberExpr
    TypeSeriesExpr // No implementation yet
    TypeTable
    TypeVariantSet
    TypeAzureResourceList
    TypeAzureAIApps
    TypeInfo
    TypeUnexpected
)

func (FuncType) String Uses

func (f FuncType) String() string

type IncidentState Uses

type IncidentState struct {
    // Since IncidentState is embedded into a template's Context these fields
    // are available to users. Changes to this object should be reflected
    // in Bosun's documentation and changes that might break user's teamplates.
    // need to be considered.
    Id       int64
    Start    time.Time
    End      *time.Time
    AlertKey AlertKey
    Alert    string // helper data since AlertKeys don't serialize to JSON well
    Tags     string // string representation of Group

    *Result

    // Most recent last.
    Events  []Event  `json:",omitempty"`
    Actions []Action `json:",omitempty"`

    Subject string

    NeedAck bool
    Open    bool

    Unevaluated bool

    CurrentStatus Status
    WorstStatus   Status

    LastAbnormalStatus Status

    LastAbnormalTime Epoch

    PreviousIds []int64 // A list to the previous IncidentIds for the same alert key (alertname+tagset)
    NextId      int64   // The id of the next Incident Id for the same alert key, only added once a future incident has been created

    // set of notifications we have already sent alerts to during the lifetime of the incident
    Notifications []string
}

func (*IncidentState) Group Uses

func (s *IncidentState) Group() opentsdb.TagSet

func (*IncidentState) IsActive Uses

func (s *IncidentState) IsActive() bool

func (*IncidentState) Last Uses

func (s *IncidentState) Last() Event

func (*IncidentState) SetNotified Uses

func (i *IncidentState) SetNotified(not string) bool

SetNotified marks the notification name as "active" for this incident. All future actions and unknown notifications will go to all "active" notifications it returns true if the set was changed (and needs resaving)

type RenderedTemplates Uses

type RenderedTemplates struct {
    Subject      string
    Body         string
    EmailBody    []byte
    EmailSubject []byte
    Custom       map[string]string
    Attachments  []*Attachment
}

func (*RenderedTemplates) Get Uses

func (r *RenderedTemplates) Get(name string) string

func (*RenderedTemplates) GetDefault Uses

func (r *RenderedTemplates) GetDefault(name string, defaultName string) string

type Result Uses

type Result struct {
    Computations `json:",omitempty"`
    Value        Float
    Expr         string
}

type Silence Uses

type Silence struct {
    Start, End time.Time
    Alert      string
    Tags       opentsdb.TagSet
    TagString  string
    Forget     bool
    User       string
    Message    string
}

func (*Silence) ActiveAt Uses

func (s *Silence) ActiveAt(now time.Time) bool

func (Silence) ID Uses

func (s Silence) ID() string

func (*Silence) Matches Uses

func (s *Silence) Matches(alert string, tags opentsdb.TagSet) bool

func (*Silence) Silenced Uses

func (s *Silence) Silenced(now time.Time, alert string, tags opentsdb.TagSet) bool

type Status Uses

type Status int
const (
    StNone Status = iota
    StNormal
    StWarning
    StCritical
    StUnknown
)

func (Status) IsCritical Uses

func (s Status) IsCritical() bool

func (Status) IsNormal Uses

func (s Status) IsNormal() bool

func (Status) IsUnknown Uses

func (s Status) IsUnknown() bool

func (Status) IsWarning Uses

func (s Status) IsWarning() bool

func (Status) MarshalJSON Uses

func (s Status) MarshalJSON() ([]byte, error)

func (Status) String Uses

func (s Status) String() string

func (*Status) UnmarshalJSON Uses

func (s *Status) UnmarshalJSON(b []byte) error

Package models imports 9 packages (graph) and is imported by 12 packages. Updated 2018-10-23. Refresh now. Tools for package owners.