Documentation ¶
Overview ¶
Package alertmanager implements a very simple alertmanager client
Index ¶
- type Alert
- func (a *Alert) GetAnnotation(key string) (value string, ok bool)
- func (a *Alert) GetAnnotationDefault(key, def string) string
- func (a *Alert) GetAnnotations() map[string]string
- func (a *Alert) GetLabel(key string) (value string, ok bool)
- func (a *Alert) GetLabelDefault(key, def string) string
- func (a *Alert) GetLabels() map[string]string
- type Client
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { Parent *Message `json:"-"` 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"` }
func (*Alert) GetAnnotation ¶
GetAnnotation gets an annotation from an alert. It will fetch annotations in Alert.Annotations with fallback to Parent.CommonAnnotations for you.
func (*Alert) GetAnnotationDefault ¶
GetAnnotationDefault gets an annotation from an alert, returning a default if it isn't present.
func (*Alert) GetAnnotations ¶
GetAnnotations returns a map of all the annotations on an alert.
func (*Alert) GetLabel ¶
GetLabel gets a label from an alert. It will fetch labels in Alert.Label with fallback to Parent.CommonLabels and Parent.GroupLabels for you.
func (*Alert) GetLabelDefault ¶
GetLabelDefault gets a label from an alert, returning a default if it isn't present.
type Message ¶
type Message struct { Version string `json:"version"` GroupKey string `json:"groupKey"` Status string `json:"status"` Receiver string `json:"receiver"` GroupLabels map[string]string `json:"groupLabels"` CommonLabels map[string]string `json:"commonLabels"` CommonAnnotations map[string]string `json:"commonAnnotations"` ExternalURL string `json:"externalURL"` Alerts []*Alert `json:"alerts"` }
Message is the JSON message sent by Prometheus Alertmanager, see https://prometheus.io/docs/alerting/configuration/#webhook_config for documentation on fields.