escalation

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_WINDOW_SIZE     = 2  // The default size of the dataframe used in window operations
	STATUS_SIZE             = 10 // The default size of the dataframe used to count statuses
	MIN_STD_DEV_WINDOW_SIZE = 5  // the smallets a window size can be for a standard deviation check
)

Variables

View Source
var (
	DEFAULT_GROUP_BY = &event.TagSet{
		{"host", "^(.*)$"},
		{"service", "^(.*)$"},
		{"sub_service", "^(.*)$"},
	}
)
View Source
var (
	Escalations = &EscalationCollection{

		factories: make(map[string]Factory),
	}
)

Functions

func AggregationTrack

func AggregationTrack(c *Condition, e *event.Event) bool

func LoadFactory

func LoadFactory(name string, f Factory)

LoadFactory loads an Factory into the globaly available map of EscalationFactories

func SimpleTrack

func SimpleTrack(c *Condition, e *event.Event) bool

Types

type Aggregation

type Aggregation struct {
	WindowLength int `json:"window_length"`
}

Config for checks based on the aggrigation of data over a time window, instead of individual data points

type Condition

type Condition struct {
	Greater       *float64     `json:"greater"`
	Less          *float64     `json:"less"`
	Exactly       *float64     `json:"exactly"`
	StdDev        bool         `json:"std_dev"`
	Derivative    bool         `json:"derivative"`
	HoltWinters   bool         `json:"holt_winters"`
	Simple        bool         `json:"simple"`
	Occurences    int          `json:"occurences"`
	WindowSize    int          `json:"window_size"`
	ModifierFuncs []string     `json:"modifier_funcs"`
	Aggregation   *Aggregation `json:"agregation"`

	sync.Mutex
	// contains filtered or unexported fields
}

Condition holds conditional information to check events against

func (*Condition) DoOnTracker

func (c *Condition) DoOnTracker(e *event.Event, dot func(*eventTracker))

func (*Condition) OccurencesHit

func (c *Condition) OccurencesHit(e *event.Event) bool

check to see if an event has hit the occurences level

func (*Condition) Satisfies

func (c *Condition) Satisfies(e *event.Event) bool

check if an event satisfies a condition

func (*Condition) StateChanged

func (c *Condition) StateChanged(e *event.Event) bool

StateChanged returns true if the state of the incoming event is not the same as the last event

func (*Condition) TrackEvent

func (c *Condition) TrackEvent(e *event.Event) bool

start tracking an event, and returns if the event has hit it's occurence settings

type Escalation

type Escalation interface {
	Send(i *event.Incident) error
	ConfigStruct() interface{}
	Init(interface{}) error
}

Escalation is the basic interface which provides a way to communicate incidents to the outside world

type EscalationCollection

type EscalationCollection struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type EscalationPolicy

type EscalationPolicy struct {
	Match    *event.TagSet     `json:"match"`
	NotMatch *event.TagSet     `json:"not_match"`
	Warn     bool              `json:"warn"`
	Crit     bool              `json:"crit"`
	Ok       bool              `json:"ok"`
	Name     string            `json:"name"`
	Comment  string            `json:"comment"`
	Configs  []json.RawMessage `json:"configs"`

	// Escalations to forward incidents to
	Escalations []Escalation `json:"-"`
	// contains filtered or unexported fields
}

EscalationPolicy is the collection of Escalations that are subscribed to by the policy

func (*EscalationPolicy) Compile

func (e *EscalationPolicy) Compile() (err error)

Compile sets up all the regex matches for the subscriptions and starts all of the Escalations held by the policy

func (*EscalationPolicy) PassIncident

func (e *EscalationPolicy) PassIncident(i *event.Incident)

PassIncident takes an incident into the escalation for processing

type Factory

type Factory func() Escalation

Factory returns a new Escalation

func GetFactory

func GetFactory(name string) Factory

GetFactory returns the Factory associated with the given name

type MatchSet

type MatchSet struct {
	Key   string
	Value *regexp.Regexp
}

type Matcher

type Matcher []MatchSet

func MatcherFromTagSet

func MatcherFromTagSet(t *event.TagSet) (Matcher, error)

func (Matcher) ForEach

func (m Matcher) ForEach(f func(k string, v *regexp.Regexp))

func (Matcher) MatchesAll

func (m Matcher) MatchesAll(t *event.TagSet) (matches bool)

MatchesAll returns true if the TagSet satisfies the entire matcher

func (Matcher) MatchesOne

func (m Matcher) MatchesOne(t *event.TagSet) (matches bool)

MatchesOne returns true if the matcher matches at least one item in the TagSet

type Policy

type Policy struct {
	Match    *event.TagSet `json:"match"`
	NotMatch *event.TagSet `json:"not_match"`
	GroupBy  *event.TagSet `json:"group_by"`
	Crit     *Condition    `json:"crit"`
	Warn     *Condition    `json:"warn"`
	Name     string        `json:"name"`
	Comment  string        `json:"comment"`
	// contains filtered or unexported fields
}

func (*Policy) ActionCrit

func (p *Policy) ActionCrit(e *event.Event) (bool, int)

ActionCrit returns the state change and the current status of the event

func (*Policy) ActionWarn

func (p *Policy) ActionWarn(e *event.Event) (bool, int)

ActionWarn returns the state change and the current status of the event

func (*Policy) CheckMatch

func (p *Policy) CheckMatch(e *event.Event) bool

CheckMatch returns true if all of match's are satisfied by the event's TagSet

func (*Policy) CheckNotMatch

func (p *Policy) CheckNotMatch(e *event.Event) bool

CheckNotMatch returns true if any of the not_match's are satisfied by the TagSet

func (*Policy) Compile

func (p *Policy) Compile(next event.IncidentPasser)

compile the regex patterns for this policy

func (*Policy) Matches

func (p *Policy) Matches(e *event.Event) bool

check to see if an event satisfies the policy

func (*Policy) PassEvent

func (p *Policy) PassEvent(e *event.Event)

Process will send exicute the next function if the event satisfies the policy

func (*Policy) Stop

func (p *Policy) Stop()

type TrackFunc

type TrackFunc func(c *Condition, e *event.Event) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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