Documentation ¶
Index ¶
Constants ¶
View Source
const ( MatchEvent = Event("match") SuccessEvent = Event("success") FailureEvent = Event("failure") )
Constants used to signal the different kind of events
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { Status string `json:"status"` Labels map[string]string `json:"labels"` Annotations map[string]string `json:"annotations"` StartsAt time.Time `json:"startsAt"` EndsAt time.Time `json:"endsAt"` GeneratorURL string `json:"generatorURL"` }
Alert holds one alert for notification templates.
type AlertGroup ¶
type AlertGroup struct { Version string `json:"version"` GroupKey string `json:"groupKey"` Receiver string `json:"receiver"` Status string `json:"status"` Alerts Alerts `json:"alerts"` GroupLabels map[string]string `json:"groupLabels"` CommonLabels map[string]string `json:"commonLabels"` CommonAnnotations map[string]string `json:"commonAnnotations"` ExternalURL string `json:"externalURL"` }
AlertGroup is the data read from a webhook call
type Configuration ¶
type Configuration struct { Matchers []MatcherConfiguration `yaml:"matchers,omitempty"` DefaultTemplate *MessageTemplate `yaml:"default_template,omitempty"` }
Configuration represents the configuration of the alert matchers
type Event ¶
type Event string
Event is an extension of a string used to map the different colors of the events
type MatcherConfiguration ¶
type MatcherConfiguration struct { Name string `yaml:"name"` Labels map[string]string `yaml:"labels"` Annotations map[string]string `yaml:"annotations"` Command string `yaml:"command"` Arguments []string `yaml:"args"` Template *MessageTemplate `yaml:"template,omitempty"` Timeout int `yaml:"timeout_seconds"` }
MatcherConfiguration provides configuration to match alerts and map them to a command with arguments
type MessageTemplate ¶
type MessageTemplate struct { OnMatch string `yaml:"on_match"` OnSuccess string `yaml:"on_success"` OnFailure string `yaml:"on_failure"` }
MessageTemplate is the message to send when the match is successful
func (MessageTemplate) GetMessage ¶
func (m MessageTemplate) GetMessage(event Event) string
GetMessage returns the template according to the event type
Click to show internal directories.
Click to hide internal directories.