Skip to content

Instantly share code, notes, and snippets.

@jidckii
Created April 5, 2023 14:08
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jidckii/5ac5f8f20368b56de72af70222509b7b to your computer and use it in GitHub Desktop.
Save jidckii/5ac5f8f20368b56de72af70222509b7b 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 }}
@SanYattsu
Copy link

Finally, found template that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment