Documentation ¶
Overview ¶
Package alertmanager contains a simple Prometheus Alertmanager client.
Index ¶
- type Alert
- type Client
- func (am *Client) CreateSilence(ctx context.Context, s Silence) (string, error)
- func (am *Client) DeleteSilence(ctx context.Context, id string) error
- func (am *Client) GetAlert(ctx context.Context, id string) (alert *Alert, err error)
- func (am *Client) GetAlerts(ctx context.Context, silenced bool) ([]*Alert, error)
- func (am *Client) GetSilences(ctx context.Context) ([]Silence, error)
- type Message
- type Silence
- func (s *Silence) Comment() string
- func (s *Silence) CreatedBy() string
- func (s *Silence) EndsAt() time.Time
- func (s *Silence) ID() string
- func (s *Silence) Matchers() labels.Matchers
- func (s *Silence) SetMatchers(matchers labels.Matchers)
- func (s *Silence) StartsAt() time.Time
- func (s *Silence) Status() string
- func (s *Silence) UpdatedAt() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
Alert represents an Alert received from Alertmanager via webhook. It is extended with the `status` attribute, and various convenient functions for formatting.
func (*Alert) LabelString ¶
LabelString returns a formatted list of message labels in the form {key="value"}.
func (*Alert) StatusString ¶
StatusString returns a string representing the status. This is either `resolved`, `silenced`, the value of the `severity` label, or `alert`.
type Client ¶
type Client struct {
API *alertmanager.AlertmanagerAPI
}
Client represents a multi-functional Alertmanager API client.
func (*Client) CreateSilence ¶ added in v0.4.0
CreateSilence creates the given silence.
func (*Client) DeleteSilence ¶ added in v0.4.0
DeleteSilence deletes the silence with the given ID.
type Silence ¶ added in v0.4.0
type Silence struct {
*models.GettableSilence
}
Silence represents a silence configured in Alertmanager.
func (*Silence) SetMatchers ¶ added in v0.4.0
SetMatchers sets the Matchers based on the given [label.Matchers].