initial

package
v0.0.0-...-6f9869b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DbDriverName = "mysql"

Variables

View Source
var InitialData = []string{"ALTER TABLE alert ADD UNIQUE INDEX ruleid_labels_firedat(`rule_id`, `labels`(255),`fired_at`);", `INSERT INTO  users  ( name,  password ) VALUES ('admin', 'e10adc3949ba59abbe56e057f20f883e');`}

Functions

func Filter

func Filter(alerts map[int64][]Record, maxCount map[int64]int) map[string][]common.Ready2Send

func InitDb

func InitDb()

func RecoverSender

func RecoverSender(SendClass map[string]map[[2]int64]*common.Ready2Send, now string)

send recovery message if alert recovered.

func Send2Hook

func Send2Hook(content []common.Ready2Send, sendTime string, t string, url string)

func SendAll

func SendAll(method string, from string, param map[string]string, content []common.Ready2Send, sendTime string)

func SendRecover

func SendRecover(url string, from string, param map[string]string, content []common.Ready2Send, sendTime string)

func Sender

func Sender(SendClass map[string][]common.Ready2Send, now string)

send alert if rule is triggered.

func UpdateMaintainlist

func UpdateMaintainlist()

Types

type Record

type Record struct {
	Id              int64
	RuleId          int64
	Value           float64
	Count           int
	Summary         string
	Description     string
	Hostname        string
	ConfirmedBefore *time.Time
	FiredAt         *time.Time
	Labels          string
}

type RecoverRecord

type RecoverRecord struct {
	Id       int64
	RuleId   int64
	Value    float64
	Count    int
	Summary  string
	Hostname string
}

Jump to

Keyboard shortcuts

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