Version: v2.17.0+incompatible Latest Latest

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

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



Package vmalert provides facilities for working with VMAlert.



This section is empty.


This section is empty.


This section is empty.


type ExternalRules

type ExternalRules struct {
	// contains filtered or unexported fields

ExternalRules contains all logic related to alerting rules files.

func NewExternalRules

func NewExternalRules() *ExternalRules

NewExternalRules creates new ExternalRules instance.

func (*ExternalRules) ReadRules

func (s *ExternalRules) ReadRules() (string, error)

ReadRules reads current rules from FS.

func (*ExternalRules) RemoveRulesFile

func (s *ExternalRules) RemoveRulesFile() error

RemoveRulesFile removes rules file from FS.

func (*ExternalRules) ValidateRules

func (s *ExternalRules) ValidateRules(ctx context.Context, rules string) error

ValidateRules validates alerting rules.

func (*ExternalRules) WriteRules

func (s *ExternalRules) WriteRules(rules string) error

WriteRules writes rules to file.

type Service

type Service struct {
	// contains filtered or unexported fields

Service is responsible for interactions with victoria metrics.

func NewVMAlert

func NewVMAlert(externalRules *ExternalRules, baseURL string) (*Service, error)

NewVMAlert creates new Victoria Metrics Alert service.

func (*Service) Collect

func (svc *Service) Collect(ch chan<- prom.Metric)

Collect implements prometheus.Collector.

func (*Service) Describe

func (svc *Service) Describe(ch chan<- *prom.Desc)

Describe implements prometheus.Collector.

func (*Service) IsReady

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

IsReady verifies that VMAlert works.

func (*Service) RequestConfigurationUpdate

func (svc *Service) RequestConfigurationUpdate()

RequestConfigurationUpdate requests VMAlert configuration update.

func (*Service) Run

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

Run runs VMAlert configuration update loop until ctx is canceled.

Jump to

Keyboard shortcuts

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