Documentation ¶
Index ¶
- Constants
- func DispatchAlert(a Alert) error
- func SendEmail(config map[string]interface{}, vars TemplateVars) error
- func SendHTTP(config map[string]interface{}, vars TemplateVars) error
- func SendPagerDuty(config map[string]interface{}, vars TemplateVars) error
- func SendSlack(config map[string]interface{}, vars TemplateVars) error
- func SendTwilio(config map[string]interface{}, vars TemplateVars) error
- type Alert
- type TemplateVars
Constants ¶
View Source
const ( AlertEmail = "email" AlertSlack = "slack" AlertHTTP = "http" AlertPagerDuty = "pagerduty" AlertTwilio = "twilio" )
alertType enum
Variables ¶
This section is empty.
Functions ¶
func DispatchAlert ¶
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.
Click to show internal directories.
Click to hide internal directories.