Alertmanager: Ability to set subject on outgoing e-mail alerts

Created on 22 Jun 2016  路  9Comments  路  Source: prometheus/alertmanager

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))
kinquestion

Most helpful comment

headers is a map so

  headers:
    subject: ...

All 9 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stuartnelson3 picture stuartnelson3  路  5Comments

FirstEncounter picture FirstEncounter  路  4Comments

xixikaikai picture xixikaikai  路  3Comments

stuartnelson3 picture stuartnelson3  路  5Comments

oryband picture oryband  路  3Comments