Documentation ¶
Index ¶
- Variables
- func Autostyle(i int) chart.Style
- func Close(reload bool)
- func Load(systemConf conf.SystemConfProvider, ruleConf conf.RuleConfProvider, ...) error
- func NewIncident(ak models.AlertKey) *models.IncidentState
- func Reset()
- func Run() error
- type Battery
- type BoardPowerReading
- type CDPCacheEntries
- type CDPCacheEntry
- type ChassisComponent
- type Context
- func (c *Context) Ack() string
- func (c *Context) ESQuery(indexRoot expr.ESIndexer, filter expr.ESQuery, sduration, eduration string, ...) (interface{}, error)
- func (c *Context) ESQueryAll(indexRoot expr.ESIndexer, filter expr.ESQuery, sduration, eduration string, ...) (interface{}, error)
- func (c *Context) Eval(v interface{}) (interface{}, error)
- func (c *Context) EvalAll(v interface{}) (interface{}, error)
- func (c *Context) Expr(v string) string
- func (c *Context) GetMeta(metric, name string, v interface{}) (interface{}, error)
- func (c *Context) Graph(v interface{}, args ...string) (interface{}, error)
- func (c *Context) GraphAll(v interface{}, args ...string) (interface{}, error)
- func (c *Context) GraphLink(v string) string
- func (c *Context) HTTPGet(url string) string
- func (c *Context) HTTPGetJSON(url string) (*jsonq.JsonQuery, error)
- func (c *Context) HTTPPost(url, bodyType, data string) string
- func (c *Context) HostView(host string) string
- func (c *Context) Incident() string
- func (c *Context) LSQuery(index_root, filter, sduration, eduration string, size int) (interface{}, error)
- func (c *Context) LSQueryAll(index_root, keystring, filter, sduration, eduration string, size int) (interface{}, error)
- func (c *Context) Last() interface{}
- func (c *Context) LeftJoin(v ...interface{}) (interface{}, error)
- func (c *Context) Lookup(table, key string) (string, error)
- func (c *Context) LookupAll(table, key string, group interface{}) (string, error)
- func (c *Context) Rule() (string, error)
- type Controller
- type Disk
- type EpochAction
- type EventSummary
- type Hardware
- type HostData
- type HostInterface
- type ICMPData
- type IncidentStatus
- type IncidentSummaryView
- type MemoryModule
- type PhysicalDisk
- type PowerSupply
- type Process
- type RunHistory
- type Schedule
- func (s *Schedule) ActionByAlertKey(user, message string, t models.ActionType, ak models.AlertKey) error
- func (s *Schedule) ActionByIncidentId(user, message string, t models.ActionType, id int64) (models.AlertKey, error)
- func (s *Schedule) ActionNotify(at models.ActionType, user, message string, aks []models.AlertKey) error
- func (s *Schedule) AddSilence(start, end time.Time, alert, tagList string, forget, confirm bool, ...) (map[models.AlertKey]bool, error)
- func (s *Schedule) AlertSuccessful(name string) bool
- func (s *Schedule) CheckAlert(T miniprofiler.Timer, r *RunHistory, a *conf.Alert) (cancelled bool)
- func (s *Schedule) CheckExpr(T miniprofiler.Timer, rh *RunHistory, a *conf.Alert, e *expr.Expr, ...) (alerts models.AlertKeys, err error, cancelled bool)
- func (s *Schedule) CheckNotifications() time.Time
- func (s *Schedule) ClearErrors(alert string) error
- func (s *Schedule) ClearSilence(id string) error
- func (s *Schedule) Close(reload bool)
- func (s *Schedule) CollectStates()
- func (s *Schedule) Data(rh *RunHistory, st *models.IncidentState, a *conf.Alert, isEmail bool) *Context
- func (s *Schedule) DeleteMetadata(tags opentsdb.TagSet, name string) error
- func (s *Schedule) ExecuteBadTemplate(errs []error, rh *RunHistory, a *conf.Alert, st *models.IncidentState) (subject, body []byte, err error)
- func (s *Schedule) ExecuteBody(rh *RunHistory, a *conf.Alert, st *models.IncidentState, isEmail bool) ([]byte, []*models.Attachment, error)
- func (s *Schedule) ExecuteSubject(rh *RunHistory, a *conf.Alert, st *models.IncidentState, isEmail bool) ([]byte, error)
- func (s *Schedule) ExprGraph(t miniprofiler.Timer, unit string, res []*expr.Result) (chart.Chart, error)
- func (s *Schedule) ExprPNG(t miniprofiler.Timer, w io.Writer, width, height int, unit string, ...) error
- func (s *Schedule) ExprSVG(t miniprofiler.Timer, w io.Writer, width, height int, unit string, ...) error
- func (s *Schedule) GetLockStatus() (holder string, since time.Time)
- func (s *Schedule) GetMetadata(metric string, subset opentsdb.TagSet) ([]metadata.Metasend, error)
- func (s *Schedule) GetOpenStates() (States, error)
- func (s *Schedule) GetQuiet() bool
- func (s *Schedule) GetUnknownAndUnevaluatedAlertKeys(alert string) (unknown, uneval []models.AlertKey)
- func (s *Schedule) Host(filter string) (map[string]*HostData, error)
- func (s *Schedule) Init(systemConf conf.SystemConfProvider, ruleConf conf.RuleConfProvider, ...) error
- func (s *Schedule) Lock(method string)
- func (s *Schedule) MarshalGroups(T miniprofiler.Timer, filter string) (*StateGroups, error)
- func (s *Schedule) MetadataMetrics(metric string) (*database.MetricMetadata, error)
- func (s *Schedule) NewRunHistory(start time.Time, cache *cache.Cache) *RunHistory
- func (s *Schedule) Notify(st *models.IncidentState, n *conf.Notification)
- func (s *Schedule) PutMetadata(k metadata.Metakey, v interface{}) error
- func (s *Schedule) QueueNotification(ak models.AlertKey, n *conf.Notification, started time.Time) error
- func (s *Schedule) Reset()
- func (s *Schedule) Run() error
- func (s *Schedule) RunAlert(a *conf.Alert)
- func (s *Schedule) RunHistory(r *RunHistory)
- func (s *Schedule) Silenced() SilenceTester
- func (s *Schedule) Unlock()
- type ServiceStatus
- type SilenceTester
- type StateGroup
- type StateGroups
- type StateTuple
- type States
- type Temp
- type VM
- type VirtualDisk
Constants ¶
This section is empty.
Variables ¶
var DefaultSched = &Schedule{}
Functions ¶
func Load ¶
func Load(systemConf conf.SystemConfProvider, ruleConf conf.RuleConfProvider, skipLast, quiet bool) error
Load loads a configuration into the default schedule.
func NewIncident ¶
func NewIncident(ak models.AlertKey) *models.IncidentState
Types ¶
type BoardPowerReading ¶
type CDPCacheEntries ¶
type CDPCacheEntries []CDPCacheEntry
type CDPCacheEntry ¶
Cisco Discovery Protocol
type ChassisComponent ¶
type Context ¶
type Context struct { *models.IncidentState Alert *conf.Alert IsEmail bool Attachments []*models.Attachment // contains filtered or unexported fields }
func (*Context) ESQueryAll ¶
func (*Context) Eval ¶
Eval takes a result or an expression which it evaluates to a result. It returns a value with tags corresponding to the context's tags. If no such result is found, the first result with nil tags is returned. If no such result is found, nil is returned.
func (*Context) Expr ¶
Expr takes an expression in the form of a string, changes the tags to match the context of the alert, and returns a link to the expression page.
func (*Context) Graph ¶
Graph returns an SVG for the given result (or expression, for which it gets the result) with same tags as the context's tags.
func (*Context) GraphAll ¶
GraphAll returns an SVG for the given result (or expression, for which it gets the result).
func (*Context) GraphLink ¶
GraphLink takes an expression in the form of a string, and returns a link to the expression page's graph tab with the time set.
func (*Context) LSQueryAll ¶
func (*Context) Last ¶
func (c *Context) Last() interface{}
Hack so template can read IncidentId off of event.
func (*Context) LeftJoin ¶
LeftJoin takes slices of results and expressions for which it gets the slices of results. Then it joins the 2nd and higher slice of results onto the first slice of results. Joining is performed by group: a group that includes all tags (with same values) of the first group is a match.
func (*Context) Lookup ¶
Lookup returns the value for a key in the lookup table for the context's tagset.
type Controller ¶
type Controller struct { Status string StatusLastUpdated int64 metadata.HWControllerMeta }
type EpochAction ¶
type EpochAction struct { User string Message string Time int64 Type models.ActionType }
func MakeEpochAction ¶
func MakeEpochAction(a models.Action) EpochAction
type EventSummary ¶
func MakeEventSummary ¶
func MakeEventSummary(e models.Event) (EventSummary, bool)
EventSummary is like a models.Event but strips the Results and Unevaluated
type Hardware ¶
type Hardware struct { Memory map[string]*MemoryModule `json:",omitempty"` ChassisComponents map[string]*ChassisComponent `json:",omitempty"` Storage struct { Controllers map[string]*Controller `json:",omitempty"` PhysicalDisks map[string]*PhysicalDisk `json:",omitempty"` VirtualDisks map[string]*VirtualDisk `json:",omitempty"` Batteries map[string]*Battery } Temps map[string]*Temp PowerSupplies map[string]*PowerSupply `json:",omitempty"` BoardPowerReading *BoardPowerReading }
type HostData ¶
type HostData struct { CPU struct { Logical int64 `json:",omitempty"` Physical int64 `json:",omitempty"` PercentUsed float64 StatsLastUpdated int64 Processors map[string]string `json:",omitempty"` } ICMPData map[string]*ICMPData Disks map[string]*Disk OpenIncidents []IncidentStatus Interfaces map[string]*HostInterface UptimeSeconds int64 `json:",omitempty"` Manufacturer string `json:",omitempty"` Hardware *Hardware `json:",omitempty"` Memory struct { TotalBytes float64 UsedBytes float64 StatsLastUpdated int64 } Processes map[string]*Process `json:",omitempty"` Services map[string]*ServiceStatus `json:",omitempty"` Model string `json:",omitempty"` Name string `json:",omitempty"` OS struct { Caption string `json:",omitempty"` Version string `json:",omitempty"` } SerialNumber string `json:",omitempty"` VM *VM `json:",omitempty"` Guests []string `json:",omitempty"` }
type HostInterface ¶
type HostInterface struct { Description string `json:",omitempty"` IPAddresses []string `json:",omitempty"` RemoteMacs []string `json:",omitempty"` CDPCacheEntries CDPCacheEntries `json:",omitempty"` Inbps int64 LinkSpeed int64 `json:",omitempty"` MAC string `json:",omitempty"` Master string `json:",omitempty"` Name string `json:",omitempty"` Outbps int64 StatsLastUpdated int64 Type string }
type IncidentStatus ¶
type IncidentSummaryView ¶
type IncidentSummaryView struct { Id int64 Subject string Start int64 AlertName string Tags opentsdb.TagSet TagsString string CurrentStatus models.Status WorstStatus models.Status LastAbnormalStatus models.Status LastAbnormalTime int64 Unevaluated bool NeedAck bool Silenced bool Actions []EpochAction Events []EventSummary WarnNotificationChains [][]string CritNotificationChains [][]string }
func MakeIncidentSummary ¶
func MakeIncidentSummary(c conf.RuleConfProvider, s SilenceTester, is *models.IncidentState) (*IncidentSummaryView, error)
type MemoryModule ¶
type PhysicalDisk ¶
type PhysicalDisk struct { Status string StatusLastUpdated int64 metadata.HWDiskMeta }
type PowerSupply ¶
type RunHistory ¶
type RunHistory struct { Cache *cache.Cache Start time.Time Backends *expr.Backends Events map[models.AlertKey]*models.Event // contains filtered or unexported fields }
func (*RunHistory) AtTime ¶
func (rh *RunHistory) AtTime(t time.Time) *RunHistory
AtTime creates a new RunHistory starting at t with the same context and events as rh.
type Schedule ¶
type Schedule struct { RuleConf conf.RuleConfProvider SystemConf conf.SystemConfProvider Group map[time.Time]models.AlertKeys Search *search.Search LastCheck time.Time DataAccess database.DataAccess // contains filtered or unexported fields }
func (*Schedule) ActionByAlertKey ¶
func (*Schedule) ActionByIncidentId ¶
func (*Schedule) ActionNotify ¶
func (*Schedule) AddSilence ¶
func (*Schedule) AlertSuccessful ¶
func (*Schedule) CheckAlert ¶
func (s *Schedule) CheckAlert(T miniprofiler.Timer, r *RunHistory, a *conf.Alert) (cancelled bool)
func (*Schedule) CheckNotifications ¶
CheckNotifications processes past notification events. It returns the next time a notification is needed.
func (*Schedule) ClearErrors ¶
func (*Schedule) ClearSilence ¶
func (*Schedule) CollectStates ¶
func (s *Schedule) CollectStates()
CollectStates sends various state information to bosun with collect.
func (*Schedule) Data ¶
func (s *Schedule) Data(rh *RunHistory, st *models.IncidentState, a *conf.Alert, isEmail bool) *Context
func (*Schedule) DeleteMetadata ¶
func (*Schedule) ExecuteBadTemplate ¶
func (s *Schedule) ExecuteBadTemplate(errs []error, rh *RunHistory, a *conf.Alert, st *models.IncidentState) (subject, body []byte, err error)
func (*Schedule) ExecuteBody ¶
func (s *Schedule) ExecuteBody(rh *RunHistory, a *conf.Alert, st *models.IncidentState, isEmail bool) ([]byte, []*models.Attachment, error)
func (*Schedule) ExecuteSubject ¶
func (s *Schedule) ExecuteSubject(rh *RunHistory, a *conf.Alert, st *models.IncidentState, isEmail bool) ([]byte, error)
func (*Schedule) GetLockStatus ¶
func (*Schedule) GetMetadata ¶
func (*Schedule) GetOpenStates ¶
func (*Schedule) GetUnknownAndUnevaluatedAlertKeys ¶
func (*Schedule) Init ¶
func (s *Schedule) Init(systemConf conf.SystemConfProvider, ruleConf conf.RuleConfProvider, skipLast, quiet bool) error
func (*Schedule) MarshalGroups ¶
func (s *Schedule) MarshalGroups(T miniprofiler.Timer, filter string) (*StateGroups, error)
func (*Schedule) MetadataMetrics ¶
func (s *Schedule) MetadataMetrics(metric string) (*database.MetricMetadata, error)
func (*Schedule) NewRunHistory ¶
func (*Schedule) Notify ¶
func (s *Schedule) Notify(st *models.IncidentState, n *conf.Notification)
func (*Schedule) PutMetadata ¶
func (*Schedule) QueueNotification ¶
func (*Schedule) RunHistory ¶
func (s *Schedule) RunHistory(r *RunHistory)
RunHistory processes an event history and triggers notifications if needed.
func (*Schedule) Silenced ¶
func (s *Schedule) Silenced() SilenceTester
Silenced returns a function that will determine if the given alert key is silenced at the current time. A function is returned to avoid needing to enumerate all alert keys unneccesarily.
type ServiceStatus ¶
type StateGroup ¶
type StateGroup struct { Active bool `json:",omitempty"` Status models.Status CurrentStatus models.Status Silenced bool IsError bool `json:",omitempty"` Subject string `json:",omitempty"` Alert string `json:",omitempty"` AlertKey models.AlertKey `json:",omitempty"` Ago string `json:",omitempty"` State *models.IncidentState `json:",omitempty"` Children []*StateGroup `json:",omitempty"` }
type StateGroups ¶
type StateGroups struct { Groups struct { NeedAck []*StateGroup `json:",omitempty"` Acknowledged []*StateGroup `json:",omitempty"` } TimeAndDate []int FailingAlerts, UnclosedErrors int }
type StateTuple ¶
type States ¶
type States map[models.AlertKey]*models.IncidentState
func (States) GroupSets ¶
GroupSets returns slices of TagSets, grouped by most common ancestor. Those with no shared ancestor are grouped by alert name.
func (States) GroupStates ¶
func (states States) GroupStates(silenced SilenceTester) map[StateTuple]States
GroupStates groups by NeedAck, Active, Status, and Silenced.