Documentation
¶
Index ¶
- Constants
- type AbstractMonitor
- func (mon *AbstractMonitor) Describe() []string
- func (mon *AbstractMonitor) GetLastStatus() MonitorStatus
- func (mon *AbstractMonitor) GetMonitor() *AbstractMonitor
- func (mon *AbstractMonitor) GetStatus() MonitorStatus
- func (mon *AbstractMonitor) GetTestFunc() MonitorTestFunc
- func (mon *AbstractMonitor) Start(testFunc MonitorTestFunc, wg *sync.WaitGroup, tickFunc MonitorTickFunc, ...)
- func (mon *AbstractMonitor) Stop()
- func (mon *AbstractMonitor) UpdateLastStatus(status MonitorStatus) (old MonitorStatus)
- func (mon *AbstractMonitor) Validate(validate backendValidateFunc) []string
- type DNSAnswer
- type DNSMonitor
- type HTTPMonitor
- type MessageTemplate
- type MonitorInterface
- type MonitorStatus
- type MonitorTemplates
- type MonitorTestFunc
- type MonitorTickFunc
Constants ¶
View Source
const ( MonitorStatusUp = "up" MonitorStatusDown = "down" MonitorStatusNotSaturated = "unsaturated" )
View Source
const DefaultInterval = time.Second * 60
View Source
const DefaultTimeout = time.Second
View Source
const HistorySize = 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractMonitor ¶
type AbstractMonitor struct {
Name string
Target string
// (default)http / dns
Type string
Strict bool
Interval time.Duration
Timeout time.Duration
Params map[string]interface{}
// Templating stuff
Template MonitorTemplates
// Threshold = percentage / number of down incidents
Threshold float32
ThresholdCount bool `mapstructure:"threshold_count"`
// contains filtered or unexported fields
}
AbstractMonitor data model
func (*AbstractMonitor) Describe ¶
func (mon *AbstractMonitor) Describe() []string
func (*AbstractMonitor) GetLastStatus ¶
func (mon *AbstractMonitor) GetLastStatus() MonitorStatus
func (*AbstractMonitor) GetMonitor ¶
func (mon *AbstractMonitor) GetMonitor() *AbstractMonitor
func (*AbstractMonitor) GetStatus ¶
func (mon *AbstractMonitor) GetStatus() MonitorStatus
TODO: test AnalyseData decides if the monitor is statistically up or down and creates / resolves an incident
func (*AbstractMonitor) GetTestFunc ¶
func (mon *AbstractMonitor) GetTestFunc() MonitorTestFunc
func (*AbstractMonitor) Start ¶
func (mon *AbstractMonitor) Start(testFunc MonitorTestFunc, wg *sync.WaitGroup, tickFunc MonitorTickFunc, immediate bool)
func (*AbstractMonitor) Stop ¶
func (mon *AbstractMonitor) Stop()
func (*AbstractMonitor) UpdateLastStatus ¶
func (mon *AbstractMonitor) UpdateLastStatus(status MonitorStatus) (old MonitorStatus)
func (*AbstractMonitor) Validate ¶
func (mon *AbstractMonitor) Validate(validate backendValidateFunc) []string
type DNSMonitor ¶
type DNSMonitor struct {
AbstractMonitor `mapstructure:",squash"`
// IP:port format or blank to use system defined DNS
DNS string
// A(default), AAAA, MX, ...
Question string
Answers []DNSAnswer
// contains filtered or unexported fields
}
func (*DNSMonitor) Validate ¶
func (monitor *DNSMonitor) Validate(validate backendValidateFunc) []string
type HTTPMonitor ¶
type HTTPMonitor struct {
AbstractMonitor `mapstructure:",squash"`
Method string
ExpectedStatusCode int `mapstructure:"expected_status_code"`
Headers map[string]string
// compiled to Regexp
ExpectedBody string `mapstructure:"expected_body"`
// contains filtered or unexported fields
}
func (*HTTPMonitor) Describe ¶
func (mon *HTTPMonitor) Describe() []string
func (*HTTPMonitor) Validate ¶
func (mon *HTTPMonitor) Validate(validate backendValidateFunc) []string
TODO: test
type MessageTemplate ¶
type MessageTemplate struct {
Subject string `json:"subject"`
Message string `json:"message"`
// contains filtered or unexported fields
}
func (*MessageTemplate) Exec ¶
func (t *MessageTemplate) Exec(data interface{}) (string, string)
func (*MessageTemplate) SetDefault ¶
func (t *MessageTemplate) SetDefault(d MessageTemplate)
type MonitorInterface ¶
type MonitorInterface interface {
Start(MonitorTestFunc, *sync.WaitGroup, MonitorTickFunc, bool)
Stop()
Validate(validate backendValidateFunc) []string
Describe() []string
GetMonitor() *AbstractMonitor
GetTestFunc() MonitorTestFunc
GetLastStatus() MonitorStatus
UpdateLastStatus(status MonitorStatus) (old MonitorStatus)
// contains filtered or unexported methods
}
type MonitorStatus ¶
type MonitorStatus string
type MonitorTemplates ¶
type MonitorTemplates struct {
Investigating MessageTemplate
Fixed MessageTemplate
}
type MonitorTestFunc ¶
type MonitorTickFunc ¶
type MonitorTickFunc func(monitor MonitorInterface, status MonitorStatus, errs []error, lag int64)
Click to show internal directories.
Click to hide internal directories.