From a7cc47ec0b59b96a09c0c44f214bbfe3eddb82f4 Mon Sep 17 00:00:00 2001 From: liugq Date: Mon, 11 Jul 2022 14:47:23 +0800 Subject: [PATCH] update alert severity --- model/alerting/condition.go | 8 +++++--- plugin/api/alerting/message.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/model/alerting/condition.go b/model/alerting/condition.go index cec3d075..a1286990 100644 --- a/model/alerting/condition.go +++ b/model/alerting/condition.go @@ -71,7 +71,9 @@ type ConditionResultItem struct { type Severity string var SeverityWeights = map[string]int{ - "warning": 1, - "error": 2, - "critical": 3, + "info": 1, + "low": 2, + "medium": 3, + "high": 4, + "critical": 5, } \ No newline at end of file diff --git a/plugin/api/alerting/message.go b/plugin/api/alerting/message.go index 6c5be462..c3071f87 100644 --- a/plugin/api/alerting/message.go +++ b/plugin/api/alerting/message.go @@ -132,7 +132,7 @@ func (h *AlertAPI) getAlertMessageStats(w http.ResponseWriter, req *http.Request } } } - for _, status := range []string{"warning", "error", "critical"} { + for _, status := range []string{"info", "low","medium","high", "critical"} { if _, ok := statusCounts[status]; !ok { statusCounts[status] = 0 }