Skip to content

Commit

Permalink
Create compact_message_notification_template.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
rschitz committed Aug 7, 2024
1 parent 598d009 commit 4c9a988
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions etc/grafana/alerting/compact_message_notification_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# config file version
apiVersion: 1

# List of templates to import or update
templates:
# <int> organization ID, default = 1
- orgId: 1
# <string, required> name of the template, must be unique
name: compact.message
# <string, required> content of the template
template: |
{{- /* Telegram message to use: {{ template "compact.message" . }} */ -}}
{{ define "__alerts_list" -}}
{{ range . }}
{{ if len .Annotations }}
{{ range .Annotations.SortedPairs -}}
- {{ .Name }}: {{ .Value }}
{{ end -}}
{{ end }}
{{- end -}} {{- /* range */ -}}
{{- end -}} {{- /* define __alerts_list */ -}}
{{ define "telegram.message" }}
{{ if gt (len .Alerts.Firing) 0 }}
{{- template "__alerts_list" .Alerts.Firing }}{{ end -}}
{{- end -}}

0 comments on commit 4c9a988

Please sign in to comment.