Hi,
(sorry, just found this mail after I replied to your other mail)
On 3/7/20 8:49 PM, Bibin John wrote:
> I have few alerts configured in promertheus/alertmanager. I want to
> dynamically change email subject based on group name. how is it
> possible? lets say below is one of the entry.
> so in below case, email subject should be alert name or suject label
> value. is this possible?
Yes, this should be possible.
First, you can set the email options such as subject or body
per-receiver, which already gives you some flexibility.
Second, the string is templatable -- meaning you can reference a
variable (e.g. a label), which may already be what you want.
You could even work with conditionals there.
This shows the default template for the mail subject:
https://github.com/prometheus/alertmanager/blob/master/template/default.tmpl#L84
https://github.com/prometheus/alertmanager/blob/master/template/default.tmpl#L4
You can find more details about the available fields here:
https://prometheus.io/docs/alerting/notifications/
This shows the configuration:
https://prometheus.io/docs/alerting/configuration/#email_config
And here are some more examples:
https://prometheus.io/docs/alerting/notification_examples/
Hope this helps,
Christian