We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What did you do? Setup Prometheus and Alertmanager to send message to Telegram. Message is sent as raw text, no HTML tags are parsed.
What did you expect to see?
Message is formatted.
What did you see instead? Under which circumstances?
Environment
System information:
Alertmanager version:
Alertmanager image tag 'main':
docker pull quay.io/prometheus/alertmanager@sha256:1e5f1f22c0875ebffad1c39ffb5f831c94ba6dcf0be4d5e5d910cfaade11b1b7
Prometheus version:
Alertmanager configuration file:
route: group_wait: 5s group_interval: 30s receiver: 'telegram' templates: - iaas-alertmanager.tmpl receivers: - name: 'telegram' telegram_configs: - bot_token: 'xxxx' chat_id: -xxxx message: '{{ template "telegram.iaas.message" . }}' parse_mode: 'HTML'
iaas-alertmanager.tmpl file (simple notification template with HTML tags)
iaas-alertmanager.tmpl
{{ define "__iaas_alert_list" }} {{ range . }} --- 🪪 <b>{{ .Labels.alertname }}</b> <b></b> {{- if .Annotations.summary }} 📝 Summary: {{ .Annotations.summary }}{{ end }}{{- if .Annotations.title }} 📕 Title: {{ .Annotations.title }}{{ end }}{{- if .Annotations.description }} 📖 Description: <code>{{ .Annotations.description }}</code>{{ end }}{{ if .Annotations.assignees }} 🏷️ Labels:{{ if .Labels.severity }} <i>Instance</i>: <code>{{ .Labels.instance }}</code>{{ end }}{{ if .Labels.job }} <i>Job</i>: <code>{{ .Labels.job }}</code>{{ end }} Owner: <code>Iaas team</code> Since: <code>{{ .StartsAt.Local.Format "02/01/2006 15:04:05" }}</code> {{ if not .EndsAt.IsZero }} Ended: <code>{{ .EndsAt.Local.Format "02/01/2006 15:04:05" }}</code>{{ end }} {{ end }} {{ end }} {{ define "telegram.iaas.message" }} {{- if gt (len .Alerts.Firing) 0 }} 🔥 Alerts Firing 🔥 {{- template "__iaas_alert_list" .Alerts.Firing }} {{- end }} {{- if gt (len .Alerts.Resolved) 0 }} ✅ Alerts Resolved ✅ {{- template "__iaas_alert_list" .Alerts.Resolved }} {{- end }} {{- end }} {{ define "telegram.iaas.message.summary" }} {{if eq .Status "firing"}} <b>📑 {{.CommonAnnotations.summary}}</b> {{ (index .Alerts 0).StartsAt.Local.Format "02/01/2006 15:04:05" }} <b></b> {{- range $val := .Alerts }} {{ $val.Labels.alertname }} {{ $val.Annotations.description }} {{- end }} {{ end }} {{ end }}
global: scrape_interval: 1s evaluation_interval: 1s rule_files: - 'rules.yml' # alert alerting: alertmanagers: - scheme: http static_configs: - targets: - 'localhost:9093' scrape_configs: - job_name: prometheus metrics_path: /metrics/ authorization: credentials: my_random_prometheus_secret static_configs: - targets: ['host.docker.internal:8080']
nothing special
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What did you do?
Setup Prometheus and Alertmanager to send message to Telegram. Message is sent as raw text, no HTML tags are parsed.
What did you expect to see?
Message is formatted.
What did you see instead? Under which circumstances?
Environment
System information:
Alertmanager version:
Alertmanager image tag 'main':
Prometheus version:
Alertmanager configuration file:
iaas-alertmanager.tmpl
file (simple notification template with HTML tags)The text was updated successfully, but these errors were encountered: