It would be really nice to set a templated subject for outgoing e-mail alerts.
Right now I get subjects like this, which are a bit heavy on (irrelevant) information:
[FIRING:1] win_disk_latency_critical (Disk latency > 40ms 1E exc02 windows-monitoring-pack 22 .....itor.no:9107 scollector .....nitor critical read round(rate(win_disk_duration{#TAGS#}[1m]) * 1000))
You can by setting the subject header, https://prometheus.io/docs/alerting/configuration/#email-receiver-email_config
Except that doesn't seem to work:
time="2016-06-21T23:25:54Z" level=error msg="Loading configuration file failed: yaml: unmarshal errors:\n line 67: cannot unmarshal !!str `{{ temp...` into map[string]string" file="/etc/alertmanager/config.yml" source="main.go:128"
email_configs:
- to: '[email protected]'
html: '{{ template "email.html" . }}'
headers: '{{ template "email.subject" . }}'
headers is a map so
headers:
subject: ...
Yay! That is working! The docs could maybe be a bit clearer and show an example :)
what if i want to add alertname in subject line?
Ex:
headers:
Subject: 'Dev Alerts'
This is a usage question. Please direct usage questions to [email protected], where it will reach a wider audience and can benefit others.
thanks. I sent a mail to the group.
thanks. I sent a mail to the group.
what template you have used here. I want to send severity in email subject.
Most helpful comment
headersis a map so