alert

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AlertEmail     = "email"
	AlertSlack     = "slack"
	AlertHTTP      = "http"
	AlertPagerDuty = "pagerduty"
	AlertTwilio    = "twilio"
)

alertType enum

Variables

This section is empty.

Functions

func DispatchAlert

func DispatchAlert(a Alert) error

DispatchAlert actually sends the Alert based on configuration and business rules

func SendEmail

func SendEmail(config map[string]interface{}, vars TemplateVars) error

SendEmail dispatches an alert by e-mail

func SendHTTP

func SendHTTP(config map[string]interface{}, vars TemplateVars) error

SendHTTP posts an alert on a custom HTTP endpoint

func SendPagerDuty

func SendPagerDuty(config map[string]interface{}, vars TemplateVars) error

SendPagerDuty post a message on a PagerDuty webhook

func SendSlack

func SendSlack(config map[string]interface{}, vars TemplateVars) error

SendSlack post a message on a Slack webhook

func SendTwilio

func SendTwilio(config map[string]interface{}, vars TemplateVars) error

SendTwilio post a message on a Twilio webhook

Types

type Alert

type Alert struct {
	ChannelType   string
	ChannelConfig map[string]interface{}

	Vars TemplateVars
}

Alert is a description of an alert to dispatch. It contains the details about the channel to dispatch the alert on and the variables to inject into the message template.

type TemplateVars

type TemplateVars struct {
	Title       string `json:"title"`
	Message     string `json:"message"`
	Target      string `json:"target"`
	Agent       string `json:"agent"`
	Probe       string `json:"probe"`
	State       string `json:"state"`
	Reason      string `json:"reason"`
	OK          bool   `json:"ok"`
	Critical    bool   `json:"critical"`
	Warning     bool   `json:"warning"`
	MissingData bool   `json:"missing_data"`
	Error       bool   `json:"error"`
}

TemplateVars is the set of variables to inject into the message template for a channel type.

Jump to

Keyboard shortcuts

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