Documentation ¶
Index ¶
- Constants
- Variables
- func Filter(alerts map[int64][]Record, maxCount map[int64]int) map[string][]common.Ready2Send
- func InitDb()
- func RecoverSender(SendClass map[string]map[[2]int64]*common.Ready2Send, now string)
- func Send2Hook(content []common.Ready2Send, sendTime string, t string, url string)
- func SendAll(method string, from string, param map[string]string, ...)
- func SendRecover(url string, from string, param map[string]string, content []common.Ready2Send, ...)
- func Sender(SendClass map[string][]common.Ready2Send, now string)
- func UpdateMaintainlist()
- type Record
- type RecoverRecord
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 ¶
Filter的作用:收集每个报警渠道以及该渠道包含的需要发送的告警信息列表,返回map[string][]common.Ready2Send 返回值: // key是告警渠道信息,如DINGTALK http://127.0.0.1/ tokenxxxx。
// value是各个告警信息的列表,下面进行遍历每个告警,进行发送。就是Ready2Send的切片集合
func RecoverSender ¶
func RecoverSender(SendClass map[string]map[[2]int64]*common.Ready2Send, now string)
send recovery message if alert recovered.
func SendRecover ¶
func Sender ¶
func Sender(SendClass map[string][]common.Ready2Send, now string)
在规则触发后,调用此方法发送告警。
参数1:SendClass:key是告警渠道信息,如DINGTALK http://127.0.0.1/ tokenxxxx。
value是各个告警信息的列表,下面进行遍历每个告警,进行发送。就是Ready2Send的切片集合
参数2:当前时间
func UpdateMaintainlist ¶
func UpdateMaintainlist()
Types ¶
Click to show internal directories.
Click to hide internal directories.