Commit 5fb1d776 authored by jingbo.wang's avatar jingbo.wang

忽略告警 aaa、 vcc-talos

parent 5f912a3e
...@@ -19,12 +19,17 @@ const ( ...@@ -19,12 +19,17 @@ const (
var HandlerMap = new(sync.Map) var HandlerMap = new(sync.Map)
var HttpGetRetryCount = 3 var HttpGetRetryCount = 3
var HttpTimeOut = time.Second * 10 var HttpTimeOut = time.Second * 10
var IgnoreServiceMap = make(map[string]struct{})
func init() { func init() {
//TODO 灵活配置
HandlerMap.Store("aaaa", "http://www.baidasdfasdfasdfasdfu.com/") HandlerMap.Store("aaaa", "http://www.baidasdfasdfasdfasdfu.com/")
HandlerMap.Store("heimdallr", "http://172.20.6.33:8989/service-down")
// HandlerMap.Store("aaaa", "http://172.20.6.33:8989/service-down") // HandlerMap.Store("aaaa", "http://172.20.6.33:8989/service-down")
//TODO 灵活配置 //TODO 灵活配置
HandlerMap.Store("heimdallr", "http://172.20.6.33:8989/service-down") IgnoreServiceMap["vcc-talos"] = struct{}{}
IgnoreServiceMap["aaaa"] = struct{}{}
} }
func httpGet(url string, timeout time.Duration) (*http.Response, error) { func httpGet(url string, timeout time.Duration) (*http.Response, error) {
...@@ -95,7 +100,9 @@ func (w watch) UpdateNodes(service *registry.Service) { ...@@ -95,7 +100,9 @@ func (w watch) UpdateNodes(service *registry.Service) {
if oldNode, ok := oldService.NodeMap[node.Id]; ok { if oldNode, ok := oldService.NodeMap[node.Id]; ok {
if oldNode.Status == Passing && node.Status == Critical { if oldNode.Status == Passing && node.Status == Critical {
logger.Warning.Print(service.Name, " ", node.Id, "---!!!node critical!!!---") logger.Warning.Print(service.Name, " ", node.Id, "---!!!node critical!!!---")
_ = dingding.SenderDingDing(service.Name+" "+node.Id+" "+"---!!!node critical!!!---", dingding.DefaultDingURL) if _, ok := IgnoreServiceMap[service.Name]; !ok {
_ = dingding.SenderDingDing(service.Name+" "+node.Id+" "+"---!!!node critical!!!---", dingding.DefaultDingURL)
}
} }
} }
} }
...@@ -106,7 +113,9 @@ func (w watch) UpdateNodes(service *registry.Service) { ...@@ -106,7 +113,9 @@ func (w watch) UpdateNodes(service *registry.Service) {
serviceString := serviceStr(service) serviceString := serviceStr(service)
if oldService, ok := servicesStatus[service.Name]; ok && serviceStatus(oldService) && !serviceStatus(service) { if oldService, ok := servicesStatus[service.Name]; ok && serviceStatus(oldService) && !serviceStatus(service) {
logger.Warning.Print(serviceString, "---!!!service critical!!!---") logger.Warning.Print(serviceString, "---!!!service critical!!!---")
_ = dingding.SenderDingDing(serviceString+"---!!!service critical!!!---", dingding.DefaultDingURL) if _, ok := IgnoreServiceMap[service.Name]; !ok {
_ = dingding.SenderDingDing(serviceString+"---!!!service critical!!!---", dingding.DefaultDingURL)
}
handler(service.Name) handler(service.Name)
} else { } else {
logger.Info.Print(serviceString) logger.Info.Print(serviceString)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment