Documentation ¶
Index ¶
- func ExecTemplate(q QueryFn, annotations map[string]string, tpl AlertTplData) (map[string]string, error)
- func InitTemplateFunc(externalURL *url.URL)
- func ValidateTemplates(annotations map[string]string) error
- type Alert
- type AlertManager
- type AlertState
- type AlertTplData
- type AlertURLGenerator
- type Notifier
- type QueryFn
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecTemplate ¶ added in v1.50.2
func ExecTemplate(q QueryFn, annotations map[string]string, tpl AlertTplData) (map[string]string, error)
ExecTemplate executes the given template for given annotations map.
func InitTemplateFunc ¶
InitTemplateFunc initiates template helper functions
func ValidateTemplates ¶ added in v1.35.0
ValidateTemplates validate annotations for possible template error, uses empty data for template population
Types ¶
type Alert ¶
type Alert struct { GroupID uint64 Name string Labels map[string]string Annotations map[string]string State AlertState Expr string Start time.Time End time.Time Value float64 ID uint64 }
Alert the triggered alert TODO: Looks like alert name isn't unique
type AlertManager ¶
type AlertManager struct {
// contains filtered or unexported fields
}
AlertManager represents integration provider with Prometheus alert manager https://github.com/prometheus/alertmanager
func NewAlertManager ¶
func NewAlertManager(alertManagerURL, user, pass string, fn AlertURLGenerator, c *http.Client) *AlertManager
NewAlertManager is a constructor for AlertManager
type AlertState ¶
type AlertState int
AlertState type indicates the Alert state
const ( // StateInactive is the state of an alert that is neither firing nor pending. StateInactive AlertState = iota // StatePending is the state of an alert that has been active for less than // the configured threshold duration. StatePending // StateFiring is the state of an alert that has been active for longer than // the configured threshold duration. StateFiring )
type AlertTplData ¶ added in v1.50.2
AlertTplData is used to execute templating
type AlertURLGenerator ¶
AlertURLGenerator returns URL to single alert by given name
type Notifier ¶
Notifier is common interface for alert manager provider
func Init ¶ added in v1.37.4
func Init(gen AlertURLGenerator) ([]Notifier, error)
Init creates a Notifier object based on provided flags.
type QueryFn ¶ added in v1.50.0
type QueryFn func(query string) ([]datasource.Metric, error)
QueryFn is used to wrap a call to datasource into simple-to-use function for templating functions.
type Time ¶
type Time int64
Time is the number of milliseconds since the epoch (1970-01-01 00:00 UTC) excluding leap seconds.
func TimeFromUnixNano ¶
TimeFromUnixNano returns the Time equivalent to the Unix Time t provided in nanoseconds.