alertcore

package
v0.0.0-...-1569ab3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareArrByPosition

func CompareArrByPosition(arr1 []int, arr2 []int) int

CompareArrByPosition arr1>arr2 return 1, arr1<arr2 return 1, arr1=arr2 return 0

func Reload

func Reload()

func TimeIsBlock

func TimeIsBlock(t time.Time, startTime time.Time, endTime time.Time) bool

func TimeIsEveryday

func TimeIsEveryday(t time.Time, startTime time.Time, endTime time.Time) bool

func TimeIsOffDay

func TimeIsOffDay(time time.Time) bool

Types

type AlertConfig

type AlertConfig struct {
	Thread int `yaml:"thread"`
	Buffer int `yaml:"buffer"`
}

type AlertHandler

type AlertHandler func(message *AlertMessage, ctx *Context)

type AlertMessage

type AlertMessage struct {
	Name      string                 `json:"name"`
	UniqueId  string                 `json:"uniqueid"`
	Value     string                 `json:"value"`
	Summary   string                 `json:"Summary"`
	Attribute map[string]interface{} `json:"attribute"`
}

type Alerter

type Alerter interface {
	Receive(msg *AlertMessage) error
	AlertHandlerRegister(handler AlertHandler)
	AlertIntervalRegister(name string, interval *Interval)
	AlertSilenceRegister(name string, silence *Silence)
	ReloadHandlerRegister(handler ReloadHandler)
	Reload()
	Run()
}

func GetAlerter

func GetAlerter() Alerter

func GetAlerterSingle

func GetAlerterSingle() Alerter

func NewAlerterSingle

func NewAlerterSingle(c *AlertConfig) Alerter

type Context

type Context struct {
	Values map[string]interface{}
}

type Interval

type Interval struct {
	SendTime     int64
	IntervalTime int64
}

type ReloadHandler

type ReloadHandler func(alert Alerter)

type Silence

type Silence struct {
	Type      string
	StartTime int64
	EndTime   int64
}

Jump to

Keyboard shortcuts

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