From 67b4407a9b8c23788eb36d95b360f920eafae7fa Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 7 Mar 2023 16:02:40 +0100 Subject: [PATCH] Report resolved alerts --- internal/webhook/handle.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/webhook/handle.go b/internal/webhook/handle.go index 6b520d3..3f85f78 100644 --- a/internal/webhook/handle.go +++ b/internal/webhook/handle.go @@ -12,11 +12,12 @@ import ( const ( messageTemplate = "\U0001f6a8" + ` **Alerts for group "_{{ .GroupKey }}_":**{{ range .Alerts }} -` + "\u2022" + ` {{ with .Labels.severity }}{{ if eq . "critical" }}` + "\U0001f525" + +` + "\u2022" + ` {{ if eq .Status "` + StatusResolved + `" }}` + "\u2705" + + `{{ else }}{{ with .Labels.severity }}{{ if eq . "critical" }}` + "\U0001f525" + `{{ else if eq . "warning" }}` + "\U0001f4e2" + `{{ else }}` + "\U0001f514" + `{{ end }}{{ else }}` + "\U0001f514" + - `{{ end }} {{ .Annotations.description }}{{ end }} + `{{ end }}{{ end }} {{ .Annotations.description }}{{ end }} @room` ) @@ -40,11 +41,6 @@ func (s Server) handleWebhook(w http.ResponseWriter, r *http.Request) { return } - if payload.Status != StatusFiring { - writeStatus(w, http.StatusOK) - return - } - var message bytes.Buffer err = s.tmpl.Execute(&message, payload) if err != nil {