alert

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Builder *sdk.Alert
}

func New

func New(name string, options ...Option) *Alert

type Channel

type Channel struct {
	ID   uint   `json:"id"`
	UID  string `json:"uid"`
	Name string `json:"Name"`
	Type string `json:"type"`
}

type ConditionOption

type ConditionOption func(condition *condition)

func Diff

func Diff(refID string, from string, to string) ConditionOption

Diff defines the query to execute. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example

func HasNoValue

func HasNoValue() ConditionOption

func IsAbove

func IsAbove(value float64) ConditionOption

func IsBelow

func IsBelow(value float64) ConditionOption

func IsOutsideRange

func IsOutsideRange(min float64, max float64) ConditionOption

func IsWithinRange

func IsWithinRange(min float64, max float64) ConditionOption

func Median

func Median(refID string, from string, to string) ConditionOption

Median defines the query to execute. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example

func PercentDiff

func PercentDiff(refID string, from string, to string) ConditionOption

PercentDiff defines the query to execute. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example

type ErrorMode

type ErrorMode string
const Alerting ErrorMode = "alerting"
const LastState ErrorMode = "keep_state"

type NoDataMode

type NoDataMode string
const Error NoDataMode = "alerting"
const KeepLastState NoDataMode = "keep_state"
const NoData NoDataMode = "no_data"
const OK NoDataMode = "ok"

type Operator

type Operator string
const And Operator = "and"
const Or Operator = "or"

type Option

type Option func(alert *Alert)

func EvaluateEvery

func EvaluateEvery(interval string) Option

EvaluateEvery defines the evaluation interval.

func For

func For(duration string) Option

For sets the time interval during which a query violating the threshold before the alert being actually triggered. See https://grafana.com/docs/grafana/latest/alerting/rules/#for

func If

func If(operator Operator, opts ...ConditionOption) Option

If adds a condition that could trigger the alert. See https://grafana.com/docs/grafana/latest/alerting/rules/#conditions

func Message

func Message(content string) Option

Message sets the message associated to the alert.

func Notification

func Notification(channel *Channel) Option

Notification adds a notification for this alert.

func OnExecutionError

func OnExecutionError(mode ErrorMode) Option

OnExecutionError defines the behavior on execution error. See https://grafana.com/docs/grafana/latest/alerting/rules/#execution-errors-or-timeouts

func OnNoData

func OnNoData(mode NoDataMode) Option

OnNoData defines the behavior when the query returns no data. See https://grafana.com/docs/grafana/latest/alerting/rules/#no-data-null-values

Jump to

Keyboard shortcuts

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