Some checks failed
/ Ansible Lint (push) Failing after 1m56s
the message template now just give out simple string if the list of alerts is to long
44 lines
1.3 KiB
Cheetah
44 lines
1.3 KiB
Cheetah
{{/*
|
|
Links & Resources
|
|
- https://prometheus.io/blog/2016/03/03/custom-alertmanager-templates/
|
|
- https://prometheus.io/docs/alerting/latest/notifications/
|
|
- https://gist.github.com/jidckii/5ac5f8f20368b56de72af70222509b7b
|
|
*/}}
|
|
{{ define "alert-item.telegram.ccchh.internal" }}
|
|
<b>[{{ .Labels.alertname }}] {{ .Labels.nodename }}</b>
|
|
{{- if .Annotations.summary }}
|
|
<i>Summary</i>: {{ .Annotations.summary }}
|
|
{{- end }}
|
|
{{- if .Annotations.description }}
|
|
<i>Description</i>: {{ .Annotations.description }}
|
|
{{- end }}
|
|
<i>Labels</i>:
|
|
{{ range .Labels.SortedPairs -}}
|
|
• <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
|
|
{{ end }}
|
|
{{- end }}
|
|
|
|
|
|
{{ define "alert-message.telegram.ccchh" }}
|
|
{{- if .Alerts.Firing }}
|
|
<u>🔥{{ len .Alerts.Firing }} Alert(/s) Firing 🔥</u>
|
|
{{- if le (len .Alerts.Firing) 6 }}
|
|
{{- range .Alerts.Firing }}
|
|
{{ template "alert-item.telegram.ccchh.internal" . }}
|
|
{{- end }}
|
|
{{- else }}
|
|
There are too many alerts firing at once
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if .Alerts.Resolved }}
|
|
<u>✅{{ len .Alerts.Resolved }} Alert(/s) Resolved ✅</u>
|
|
{{- if le (len .Alerts.Resolved) 6 }}
|
|
{{- range .Alerts.Resolved }}
|
|
{{ template "alert-item.telegram.ccchh.internal" . }}
|
|
{{- end }}
|
|
{{- else }}
|
|
There are too many resolved alerts to list
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|