This is already done for you.  With the default templates, the subject line 
has a prefix like [FIRING:2] or [RESOLVED].

However if your alerts are being grouped, and let's say one alert resolves, 
then you might then get an E-mail with subject [FIRING:1] which shows one 
alert still firing and one alert resolved.  That is: a single E-mail may 
contain both "DOWN" and "UP" notifications.

You can change the templates if you like.  There is documentation here 
<https://prometheus.io/docs/alerting/latest/notifications/>.  The default 
subject line is created here 
<https://github.com/prometheus/alertmanager/blob/main/template/default.tmpl#L4> 
and 
you can override this with your own template string.

But to be honest, I've switched off all "resolved" notifications now.  
There's a good explanation why here:
https://www.robustperception.io/running-into-burning-buildings-because-the-fire-alarm-stopped

In short: the fact that an alert condition has ceased is not an excuse to 
your staff to say "oh that's OK, the problem has gone; I can ignore it 
now".  There *was* a problem and it *still* needs to be investigated.  You 
can use an alert to open a ticket, but you should close the ticket manually.

This document is also *very* well worth reading:
https://docs.google.com/document/d/199PqyG3UsyXlwieHaqbGiWVa8eMWi8zzAn0YfcApr8Q/edit

On Thursday, 18 November 2021 at 08:54:08 UTC [email protected] wrote:

> Hi Team,
>
> I want to set the subject line in alertmanager based on send_resolved 
> status. I mean before resolving the alert subject line should be "DOWN" and 
> after resolving the alert subject line should be set to "UP".
>
> Could someone please guide me how to achieve this or provide me syntax 
> please?
>
> Best Regards,
> Sriman
>

-- 
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/5456859c-2934-4144-9b25-4cfc7827f205n%40googlegroups.com.

Reply via email to