monitoring/conf/alertmanager/templates/telegram.tmpl

11 lines
669 B
Cheetah
Raw Normal View History

2022-04-22 20:16:39 +02:00
{{ define "telegram.custom.message" }}
{{ range .Alerts }}
{{ if eq .Status "firing"}}🔥<b>{{ .Labels.alertname }}</b>🔥{{ else }}👌<b>{{ .Labels.alertname }}</b>👌{{ end }}
<b>Labels:</b>{{ range $key, $value := .Labels }}{{ if ne $key "alertname" }}
- {{ $key }}: {{ reReplaceAll "(<|>)+" "" $value }}{{ end }}{{ end }}
2022-04-22 20:16:39 +02:00
<b>Annotations:</b>{{ range $key, $value := .Annotations }}
- {{ $key }}: {{ reReplaceAll "(?s)(\\s+)LABELS = (.*)" "" $value }}{{ end }}
<b>Start:</b> {{ .StartsAt.Local.Format "02/01/2006 15:04:05 MST" }}{{ if eq .Status "resolved"}}
<b>Ended:</b> {{ .EndsAt.Local.Format "02/01/2006 15:04:05 MST" }}{{ end }}
2022-04-22 20:16:39 +02:00
{{ end }}
{{ end }}