🪄mutelabel生成

This commit is contained in:
Akkia
2023-04-16 22:47:12 +08:00
parent e5704157e3
commit b444a94a06
2 changed files with 10 additions and 5 deletions

View File

@@ -165,8 +165,8 @@ func checkStatus() {
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)
resolvedMuteLabel := NotificationMuteLabel.AppendNotificationTag(NotificationMuteLabel.ServerIncidentResolved(server.ID, alert.ID), alert.NotificationTag)
Cache.Delete(*resolvedMuteLabel)
}
} else {
// 本次通过检查但上一次的状态为失败,则发送恢复通知
@@ -177,8 +177,8 @@ func checkStatus() {
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)
incidentMuteLabel := NotificationMuteLabel.AppendNotificationTag(NotificationMuteLabel.ServerIncident(server.ID, alert.ID), alert.NotificationTag)
Cache.Delete(*incidentMuteLabel)
}
alertsPrevState[alert.ID][server.ID] = _RuleCheckPass
}