v0.0.0-...-e25bc3e Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2021 License: MIT Imports: 9 Imported by: 16




This section is empty.


View Source
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


This section is empty.


type Action

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

type ActionType int // Available to users in templates, document changes in Bosun docs
const (
	ActionNone ActionType = iota

func (ActionType) HumanString

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

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

func (ActionType) String

func (a ActionType) String() string

func (*ActionType) UnmarshalJSON

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

type AlertError

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

type AlertKey

type AlertKey string

func NewAlertKey

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

func ParseAlertKey

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

func (AlertKey) Group

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

func (a AlertKey) Name() string

type AlertKeys

type AlertKeys []AlertKey

func (AlertKeys) Len

func (a AlertKeys) Len() int

func (AlertKeys) Less

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

func (AlertKeys) Swap

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

type Attachment

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

type Computation

type Computation struct {
	Text  string
	Value interface{}

type Computations

type Computations []Computation

type Epoch

type Epoch struct {

func (Epoch) MarshalJSON

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

func (*Epoch) UnmarshalJSON

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

type Event

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

type EventsByTime

type EventsByTime []Event

func (EventsByTime) Len

func (a EventsByTime) Len() int

func (EventsByTime) Less

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

func (EventsByTime) Swap

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

type Float

type Float float64

custom float type to support json marshalling of NaN

func (Float) MarshalJSON

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

func (*Float) UnmarshalJSON

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

type FuncType

type FuncType int
const (
	TypeString FuncType = iota
	TypeSeriesExpr // No implementation yet

func (FuncType) String

func (f FuncType) String() string

type IncidentState

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


	// 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

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

func (*IncidentState) IsActive

func (s *IncidentState) IsActive() bool

func (*IncidentState) Last

func (s *IncidentState) Last() Event

func (*IncidentState) SetNotified

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

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

func (*RenderedTemplates) Get

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

func (*RenderedTemplates) GetDefault

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

type Result

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

type Silence

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

func (*Silence) ActiveAt

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

func (Silence) ID

func (s Silence) ID() string

func (*Silence) Matches

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

func (*Silence) Silenced

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

type Status

type Status int
const (
	StNone Status = iota

func (Status) IsCritical

func (s Status) IsCritical() bool

func (Status) IsNormal

func (s Status) IsNormal() bool

func (Status) IsUnknown

func (s Status) IsUnknown() bool

func (Status) IsWarning

func (s Status) IsWarning() bool

func (Status) MarshalJSON

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

func (Status) String

func (s Status) String() string

func (*Status) UnmarshalJSON

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL