Report resolved alerts
This commit is contained in:
parent
50d489eaf8
commit
67b4407a9b
|
@ -12,11 +12,12 @@ import (
|
||||||
const (
|
const (
|
||||||
messageTemplate = "\U0001f6a8" +
|
messageTemplate = "\U0001f6a8" +
|
||||||
` **Alerts for group "_{{ .GroupKey }}_":**{{ range .Alerts }}
|
` **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 if eq . "warning" }}` + "\U0001f4e2" +
|
||||||
`{{ else }}` + "\U0001f514" +
|
`{{ else }}` + "\U0001f514" +
|
||||||
`{{ end }}{{ else }}` + "\U0001f514" +
|
`{{ end }}{{ else }}` + "\U0001f514" +
|
||||||
`{{ end }} {{ .Annotations.description }}{{ end }}
|
`{{ end }}{{ end }} {{ .Annotations.description }}{{ end }}
|
||||||
@room`
|
@room`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,11 +41,6 @@ func (s Server) handleWebhook(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if payload.Status != StatusFiring {
|
|
||||||
writeStatus(w, http.StatusOK)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var message bytes.Buffer
|
var message bytes.Buffer
|
||||||
err = s.tmpl.Execute(&message, payload)
|
err = s.tmpl.Execute(&message, payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue