alertmanager

package
v2.17.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package alertmanager contains business logic of working with Alertmanager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is responsible for interactions with Alertmanager.

func New

func New(db *reform.DB) *Service

New creates new service.

func (*Service) FindAlertByID

func (svc *Service) FindAlertByID(ctx context.Context, id string) (*ammodels.GettableAlert, error)

FindAlertByID searches alert by ID in alertmanager.

func (*Service) GenerateBaseConfigs

func (svc *Service) GenerateBaseConfigs()

GenerateBaseConfigs generates alertmanager.base.yml if it is absent, and then writes basic alertmanager.yml if it is absent or empty. It is needed because Alertmanager was added to PMM with invalid configuration file (it will fail with "no route provided in config" error).

func (*Service) GetAlerts

func (svc *Service) GetAlerts(ctx context.Context) ([]*ammodels.GettableAlert, error)

GetAlerts returns alerts available in alertmanager.

func (*Service) IsReady

func (svc *Service) IsReady(ctx context.Context) error

IsReady verifies that Alertmanager works.

func (*Service) RequestConfigurationUpdate

func (svc *Service) RequestConfigurationUpdate()

RequestConfigurationUpdate requests Alertmanager configuration update.

func (*Service) Run

func (svc *Service) Run(ctx context.Context)

Run runs Alertmanager configuration update loop until ctx is canceled.

func (*Service) SendAlerts

func (svc *Service) SendAlerts(ctx context.Context, alerts ammodels.PostableAlerts)

SendAlerts sends given alerts. It is the caller's responsibility to call this method every now and then.

func (*Service) Silence

func (svc *Service) Silence(ctx context.Context, id string) error

Silence mutes alert with specified id.

func (*Service) Unsilence

func (svc *Service) Unsilence(ctx context.Context, id string) error

Unsilence unmutes alert with specified id.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL