Documentation ¶
Index ¶
- type Alert
- type AlertGroup
- type AlertStatus
- type AlertmanagerClient
- func (c *AlertmanagerClient) DeleteSilence(ctx context.Context, silId string) error
- func (c *AlertmanagerClient) GetAlertGroups(ctx context.Context, af *AlertsFilter) ([]*AlertGroup, error)
- func (c *AlertmanagerClient) GetAlerts(ctx context.Context, af *AlertsFilter) ([]*Alert, error)
- func (c *AlertmanagerClient) GetReceivers(ctx context.Context) ([]*Receiver, error)
- func (c *AlertmanagerClient) GetSilence(ctx context.Context, silenceId string) (*Silence, error)
- func (c *AlertmanagerClient) GetSilences(ctx context.Context, filter []string) ([]*Silence, error)
- func (c *AlertmanagerClient) GetStatus(ctx context.Context) (*AlertmanagerStatus, error)
- func (c *AlertmanagerClient) PostAlerts(ctx context.Context, alerts []*RawAlert) error
- func (c *AlertmanagerClient) PostSilence(ctx context.Context, rsil *RawSilence) (string, error)
- type AlertmanagerStatus
- type AlertsFilter
- func (f *AlertsFilter) WithActive(active bool) *AlertsFilter
- func (f *AlertsFilter) WithFilter(filter []string) *AlertsFilter
- func (f *AlertsFilter) WithInhibited(inhibited bool) *AlertsFilter
- func (f *AlertsFilter) WithReceiver(receiver string) *AlertsFilter
- func (f *AlertsFilter) WithSilenced(silenced bool) *AlertsFilter
- func (f *AlertsFilter) WithUnprocessed(unprocessed bool) *AlertsFilter
- type ClientConfig
- type Matcher
- type RawAlert
- type RawSilence
- type Receiver
- type ServiceReference
- type Silence
- type SilenceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { RawAlert Fingerprint string `json:"fingerprint"` Receivers []*Receiver `json:"receivers"` Status *AlertStatus `json:"status"` }
type AlertGroup ¶
type AlertStatus ¶
type AlertmanagerClient ¶
type AlertmanagerClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config ClientConfig) (*AlertmanagerClient, error)
func (*AlertmanagerClient) DeleteSilence ¶
func (c *AlertmanagerClient) DeleteSilence(ctx context.Context, silId string) error
func (*AlertmanagerClient) GetAlertGroups ¶
func (c *AlertmanagerClient) GetAlertGroups(ctx context.Context, af *AlertsFilter) ([]*AlertGroup, error)
GetAlerts gets alert groups by the filter.
func (*AlertmanagerClient) GetAlerts ¶
func (c *AlertmanagerClient) GetAlerts(ctx context.Context, af *AlertsFilter) ([]*Alert, error)
GetAlerts gets alerts by the filter.
func (*AlertmanagerClient) GetReceivers ¶
func (c *AlertmanagerClient) GetReceivers(ctx context.Context) ([]*Receiver, error)
func (*AlertmanagerClient) GetSilence ¶
GetSilence gets silence by silence id.
func (*AlertmanagerClient) GetSilences ¶
GetSilences gets silences by filter filter supports a simplified prometheus query syntax, contains operators: =, !=, =~, !~ . This will be used to filter your query by value matching or regex matching, and their negative.
func (*AlertmanagerClient) GetStatus ¶
func (c *AlertmanagerClient) GetStatus(ctx context.Context) (*AlertmanagerStatus, error)
func (*AlertmanagerClient) PostAlerts ¶
func (c *AlertmanagerClient) PostAlerts(ctx context.Context, alerts []*RawAlert) error
PostAlerts posts alerts to alertmanager. Alerts will be posted to every instance behind alertmanager service.
func (*AlertmanagerClient) PostSilence ¶
func (c *AlertmanagerClient) PostSilence(ctx context.Context, rsil *RawSilence) (string, error)
type AlertmanagerStatus ¶
type AlertmanagerStatus models.AlertmanagerStatus
type AlertsFilter ¶
type AlertsFilter struct { Active bool `json:"active"` Inhibited bool `json:"inhibited"` Silenced bool `json:"silenced"` Unprocessed bool `json:"unprocessed"` // filter supports a simplified prometheus query syntax, contains operators: =, !=, =~, !~ . // This will be used to filter your query by value matching or regex matching, and their negative. Filter []string `json:"filter"` Receiver string `json:"receiver"` }
func NewAlertsFilter ¶
func NewAlertsFilter() *AlertsFilter
func (*AlertsFilter) WithActive ¶
func (f *AlertsFilter) WithActive(active bool) *AlertsFilter
func (*AlertsFilter) WithFilter ¶
func (f *AlertsFilter) WithFilter(filter []string) *AlertsFilter
func (*AlertsFilter) WithInhibited ¶
func (f *AlertsFilter) WithInhibited(inhibited bool) *AlertsFilter
func (*AlertsFilter) WithReceiver ¶
func (f *AlertsFilter) WithReceiver(receiver string) *AlertsFilter
func (*AlertsFilter) WithSilenced ¶
func (f *AlertsFilter) WithSilenced(silenced bool) *AlertsFilter
func (*AlertsFilter) WithUnprocessed ¶
func (f *AlertsFilter) WithUnprocessed(unprocessed bool) *AlertsFilter
type ClientConfig ¶
type ClientConfig struct { URL string `json:"url,omitempty"` Service *ServiceReference `json:"service,omitemtpy"` }
ClientConfig contains the information to make a connection with the alertmanger If you need to post alerts to alertmanager, and you have customized the target port of alertmanager service, please configure ClientConfig.Service.Target, regardless of whether you configure URL.
type RawSilence ¶
type ServiceReference ¶
type ServiceReference struct { Namespace string `json:"namespace"` Name string `json:"name"` // The port that will be exposed by this service. Defaults to 9093 Port *int `json:"port,omitempty"` // TargetPort is the port to access on the backend instances targeted by the service. // If this is not specified, the value of the 'port' field is used. TargetPort *int `json:"targetPort,omitempty"` }
type Silence ¶
type Silence struct { RawSilence Status *SilenceStatus `json:"status"` UpdatedAt strfmt.DateTime `json:"updatedAt"` }
type SilenceStatus ¶
type SilenceStatus struct {
State string `json:"state"`
}