ansible-repo/files/alertmanager/simple_telegram.tmpl
2025-02-06 02:20:33 +10:00

34 lines
884 B
Cheetah

{{ define "teletempl" }}
<b>{{ .CommonLabels.alertname }} : </b>
{{- if eq .Status "firing" -}}
<b>{{ .Status | toUpper}} 🔥</b>
{{- end -}}
{{- if eq .Status "resolved" -}}
<b>{{ .Status | toUpper}} ✅</b>
{{- end -}}
{{ $alerts_count := len .Alerts }}
{{ if eq $alerts_count 1 -}} {{/* Single alert block */}}
{{ .CommonAnnotations.summary }}
Host: {{ .CommonLabels.host }}
Instance: {{ .CommonLabels.instance }}
Job: <b>{{ .CommonLabels.job }}</b>
Details:
{{ .CommonAnnotations.description }}
Alert started: [ {{ .CommonAnnotations.alert_started_vl_time }} ]
{{- else -}} {{/* Grouped alert block */}}
{{ .CommonAnnotations.summary }}
Job: <b>{{ .CommonLabels.job }}</b>
Instances:
{{- range .Alerts }}
{{ .Labels.instance }} [ {{ .Annotations.alert_started_vl_time }} ]
{{- end }}
{{ end }}
{{ end }}