models

package
v0.0.0-...-c7f582f Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	User    string
	Message string
	Time    time.Time
	Type    ActionType
}

type ActionType

type ActionType int
const (
	ActionNone ActionType = iota
	ActionAcknowledge
	ActionClose
	ActionForget
	ActionForceClose
	ActionPurge
	ActionNote
)

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 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
	TypeScalar
	TypeNumberSet
	TypeSeriesSet
	TypeESQuery
	TypeESIndexer
	TypeNumberExpr
	TypeSeriesExpr // No implmentation yet
	TypeTable
	TypeUnexpected
)

func (FuncType) String

func (f FuncType) String() string

type IncidentState

type IncidentState struct {
	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
	Body         string
	EmailBody    []byte
	EmailSubject []byte
	Attachments  []*Attachment

	NeedAck bool
	Open    bool

	Unevaluated bool

	CurrentStatus Status
	WorstStatus   Status

	LastAbnormalStatus Status
	LastAbnormalTime   int64
}

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

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
	StNormal
	StWarning
	StCritical
	StUnknown
)

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