slience

package
v0.0.0-...-83d3498 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlarmIsMatchDefault

func AlarmIsMatchDefault(alarm types.Alerts, matchs map[string][]Sliences) (host string, slienceNameDefault string)

func AlermIsMatch

func AlermIsMatch(silenceName Sliences, alarm types.Alerts) bool

func AlertmanagerSliences

func AlertmanagerSliences(cfg config.MonitoringConfig, host string, duration string, slience Sliences) (silenceID string, err error)

func AlertmanagerSliencesExpired

func AlertmanagerSliencesExpired(cfg config.MonitoringConfig, host string, slience Sliences) error

func GetConsumerSliences

func GetConsumerSliences(db *gorm.DB, consumerSliences *SafeSliences) error

Types

type AMSlience

type AMSlience struct {
	Matchers  []types.Matchers `json:"matchers"`
	StartsAt  time.Time        `json:"startsAt"`
	EndsAt    time.Time        `json:"endsAt"`
	CreatedBy string           `json:"createdBy"`
	Comment   string           `json:"comment"`
	ID        string           `json:"id"`
}

type AMSlienceReponse

type AMSlienceReponse struct {
	SilenceID string `json:"silenceID"`
}

type AlertmanagerGetSlienceResponse

type AlertmanagerGetSlienceResponse []struct {
	ID        string     `json:"id"`
	Status    Status     `json:"status"`
	UpdatedAt time.Time  `json:"updatedAt"`
	Comment   string     `json:"comment"`
	CreatedBy string     `json:"createdBy"`
	EndsAt    time.Time  `json:"endsAt"`
	Matchers  []Matchers `json:"matchers"`
	StartsAt  time.Time  `json:"startsAt"`
}

type Matchers

type Matchers struct {
	IsEqual bool   `json:"isEqual"`
	IsRegex bool   `json:"isRegex"`
	Name    string `json:"name"`
	Value   string `json:"value"`
}

type SafeSliences

type SafeSliences struct {
	Mu sync.RWMutex
	//           instance   alertName
	//Sliences map[string]map[string][]types.Matchers
	Sliences map[string][]Sliences
}

type Sliences

type Sliences struct {
	SlienceName string
	IsDefault   bool
	To          int
	Matchers    []types.Matchers
}

func (Sliences) StringMatchers

func (s Sliences) StringMatchers() string

type Status

type Status struct {
	State string `json:"state"`
}

Jump to

Keyboard shortcuts

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