报警任务状态改变时 清除另一个状态的muteLabel

This commit is contained in:
Akkia 2023-04-15 19:04:04 +08:00
parent a4fd818f02
commit 48802cc432
No known key found for this signature in database
GPG Key ID: DABE9A4AB2DD7EF3

View File

@ -164,6 +164,9 @@ func checkStatus() {
}), server.Name, IPDesensitize(server.Host.IP), alert.Name)
go SendTriggerTasks(alert.FailTriggerTasks, curServer.ID)
go SendNotification(alert.NotificationTag, message, NotificationMuteLabel.ServerIncident(server.ID, alert.ID), &curServer)
// 清除恢复通知的静音缓存
resolvedMuteLabel := fmt.Sprintf("%s:%s", *NotificationMuteLabel.ServerIncidentResolved(server.ID, alert.ID), alert.NotificationTag)
Cache.Delete(resolvedMuteLabel)
}
} else {
// 本次通过检查但上一次的状态为失败,则发送恢复通知
@ -173,6 +176,9 @@ func checkStatus() {
}), server.Name, IPDesensitize(server.Host.IP), alert.Name)
go SendTriggerTasks(alert.RecoverTriggerTasks, curServer.ID)
go SendNotification(alert.NotificationTag, message, NotificationMuteLabel.ServerIncidentResolved(server.ID, alert.ID), &curServer)
// 清除失败通知的静音缓存
incidentMuteLabel := fmt.Sprintf("%s:%s", *NotificationMuteLabel.ServerIncident(server.ID, alert.ID), alert.NotificationTag)
Cache.Delete(incidentMuteLabel)
}
alertsPrevState[alert.ID][server.ID] = _RuleCheckPass
}