Hello community,
I have written this template for notifications to pagerduty:
pagerduty.tmpl: |-
{{ define "pagerduty.one_line" -}}
[{{ .Status | toUpper }}:{{ .Alerts.Firing | len }}] {{
.CommonLabels.alertname }} -
{{ range .Alerts }}
{{- if .Annotations.description -}}
{{ .Annotations.description }}
{{- else if .Annotations.message -}}
{{ .Annotations.message }}
{{- else -}}
No additional details provided.
{{- end }}
{{- "\n" -}}
{{ end }}
{{- end }}
Here how i referenced it in my receiver config:
receivers: - name: 'pagerduty'
pagerduty_configs:
- service_key: f73***
description: '{{ template "pagerduty.one_line" . }}'
send_resolved: true
Issue: I can`t see notifications in Pagerduty but in Slack, were I use
another template I can see notification.
My alertmanager pod show below logs:
ts=2024-09-10T07:58:35.002Z caller=dispatch.go:353 level=error
component=dispatcher msg="Notify for alerts failed" num_alerts=2
err="pagerduty/pagerduty[0]: notify retry canceled due to unrecoverable
error after 1 attempts: failed to template PagerDuty v1 message: template:
:1:12: executing \"\" at <{{template \"pagerduty.one_line\" .}}>: template
\"pagerduty.one_line\" not defined"
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/c16e351c-6b70-4287-9b29-70b874852ab1n%40googlegroups.com.