Skip to content

Instantly share code, notes, and snippets.

@UAnton
Forked from jidckii/alertmanager.tmpl
Created June 29, 2023 17:51
Show Gist options
  • Save UAnton/2395bf069b44d41c3b0e7fd872b37ca5 to your computer and use it in GitHub Desktop.
Save UAnton/2395bf069b44d41c3b0e7fd872b37ca5 to your computer and use it in GitHub Desktop.
Alertmanager telegram template
{{ define "__yucca_text_alert_list" }}{{ range . }}
---
πŸͺͺ <b>{{ .Labels.alertname }}</b>
{{- if .Annotations.summary }}
πŸ“ {{ .Annotations.summary }}{{ end }}
{{- if .Annotations.description }}
πŸ“– {{ .Annotations.description }}{{ end }}
🏷 Labels:
{{ range .Labels.SortedPairs }} <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
{{ end }}{{ end }}
πŸ›  <a href="https://yucca.app/">Grafana</a> πŸ’Š <a href="https://yucca.app/">Alertmanager</a> πŸ’Š <a href="https://yucca.app/">Prometheus</a> πŸ› 
{{ end }}
{{ define "telegram.yucca.message" }}
{{ if gt (len .Alerts.Firing) 0 }}
πŸ”₯ Alerts Firing πŸ”₯
{{ template "__yucca_text_alert_list" .Alerts.Firing }}
{{ end }}
{{ if gt (len .Alerts.Resolved) 0 }}
βœ… Alerts Resolved βœ…
{{ template "__yucca_text_alert_list" .Alerts.Resolved }}
{{ end }}
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment