groups:
- name: example
rules:
# Alert for any node down for 20s
- alert: InstanceDown
expr: up == 0
for: 20s
labels:
severity: 'critical'
target: 'targetNotifierSystem'
...receivers:
- name: 'target-mail'
email_configs:
- to: 'target@email'
send_resolved: true
headers:
subject: '[{{ .Labels.severity }}] Test mail subject'
html: null
...
level=error ts=2018-08-30T02:02:21.178883979Z caller=notify.go:332 component=dispatcher msg="Error on notify" err="cancelling notify retry for \"email\" due to unrecoverable error: executing \"Subject\" header template: template: :1:11: executing \"\" at <.Labels.severity>: can't evaluate field Labels in type *template.Data"
I want to extract say, the value of an alert label and put it in the Subject of my mail.a simpler form of the current setup i have is:rules.yml (Prometheus)
groups:- name: example
rules:
# Alert for any node down for 20s
- alert: InstanceDown
expr: up == 0
for: 20s
labels:
severity: 'critical'
target: 'targetNotifierSystem'
and the corresponding alertmanager settings.yml
...receivers:
- name: 'target-mail'
email_configs:
- to: 'target@email'
send_resolved: true
headers:
subject: '[{{ .Labels.severity }}] Test mail subject'
html: null
...
My aim is to replace .Labels.severity with 'critical'. This setup throws some parsing errors.level=error ts=2018-08-30T02:02:21.178883979Z caller=notify.go:332 component=dispatcher msg="Error on notify" err="cancelling notify retry for \"email\" due to unrecoverable error: executing \"Subject\" header template: template: :1:11: executing \"\" at <.Labels.severity>: can't evaluate field Labels in type *template.Data"
using .CommonLabels.severity inserts nothing.
--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/c13c5d29-ccd5-434d-aa85-40941af49d3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.