notifier

package
Version: v2.24.1-v2-2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	// Label value pairs for purpose of aggregation, matching, and disposition
	// dispatching. This must minimally include an "alertname" label.
	Labels labels.Labels `json:"labels"`

	// Extra key/value information which does not define alert identity.
	Annotations labels.Labels `json:"annotations"`

	// The known time range for this alert. Both ends are optional.
	StartsAt     time.Time `json:"startsAt,omitempty"`
	EndsAt       time.Time `json:"endsAt,omitempty"`
	GeneratorURL string    `json:"generatorURL,omitempty"`
}

Alert is a generic representation of an alert in the Prometheus eco-system.

func (*Alert) Hash

func (a *Alert) Hash() uint64

Hash returns a hash over the alert. It is equivalent to the alert labels hash.

func (*Alert) Name

func (a *Alert) Name() string

Name returns the name of the alert. It is equivalent to the "alertname" label.

func (*Alert) Resolved

func (a *Alert) Resolved() bool

Resolved returns true iff the activity interval ended in the past.

func (*Alert) ResolvedAt

func (a *Alert) ResolvedAt(ts time.Time) bool

ResolvedAt returns true iff the activity interval ended before the given timestamp.

func (*Alert) String

func (a *Alert) String() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is responsible for dispatching alert notifications to an alert manager service.

func NewManager

func NewManager(o *Options, logger log.Logger) *Manager

NewManager is the manager constructor.

func (*Manager) Alertmanagers

func (n *Manager) Alertmanagers() []*url.URL

Alertmanagers returns a slice of Alertmanager URLs.

func (*Manager) ApplyConfig

func (n *Manager) ApplyConfig(conf *config.Config) error

ApplyConfig updates the status state as the new config requires.

func (*Manager) DroppedAlertmanagers

func (n *Manager) DroppedAlertmanagers() []*url.URL

DroppedAlertmanagers returns a slice of Alertmanager URLs.

func (*Manager) Run

func (n *Manager) Run(tsets <-chan map[string][]*targetgroup.Group)

Run dispatches notifications continuously.

func (*Manager) Send

func (n *Manager) Send(alerts ...*Alert)

Send queues the given notification requests for processing. Panics if called on a handler that is not running.

func (*Manager) Stop

func (n *Manager) Stop()

Stop shuts down the notification handler.

type Options

type Options struct {
	QueueCapacity  int
	ExternalLabels labels.Labels
	RelabelConfigs []*relabel.Config
	// Used for sending HTTP requests to the Alertmanager.
	Do func(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)

	Registerer prometheus.Registerer
}

Options are the configurable parameters of a Handler.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto