How can I define a different email subject for first notification
46 views
Skip to first unread message
eyal trigerman
unread,
Mar 11, 2020, 9:45:57 AM3/11/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
Hi,
I would like to configure a different template for email subject:
one template for the first notification for an alert
other template for repeating notifications for an alert
Thanks!
Christian Hoffmann
unread,
Mar 11, 2020, 5:01:54 PM3/11/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to eyal trigerman, Prometheus Users
Hi,
I'm not sure if Alertmanager exposes this state for usage in the template.
You could probably heuristically derive this information from the
StartsAt value when compared with your repeat interval. However, I'm not
sure if the available functions are sufficient to do that. Maybe some
further research will shed some more light on this. :)
Kind regards,
Christian
eyal trigerman
unread,
Mar 12, 2020, 3:44:47 AM3/12/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
Thanks!
Can I have an example for a condition based on StartsAt?
בתאריך יום רביעי, 11 במרץ 2020 בשעה 23:01:54 UTC+2, מאת Christian Hoffmann:
Christian Hoffmann
unread,
Mar 14, 2020, 8:01:14 AM3/14/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to eyal trigerman, Prometheus Users
Hi,
On 3/12/20 8:44 AM, eyal trigerman wrote:
> Thanks!
> Can I have an example for a condition based on StartsAt?
I don't have a specific example, I guess you will have to play around a bit.
For this to work, you probably should have your grouping set up in a way
which sends exactly one alert per group.
Then, you can reference this one alert's StartTime (e.g.
Alerts.Firing()[0].StartsAt -- totally not sure about the exact syntax).
There are conditional comparisons available in the Go templating (e.g.
lt or gt).
What I currently don't know is where to get the value from comparison
from -- this should be the same datetype as the StartsAt field but would
have to be set to "4 hours earlier" (or something; according to your
repeat_interval). This is the part where I'm not sure if there is a way
at all.
Maybe you can play around with this for yourself and ask again if you
hit a specific showstopper. Maybe other people can also chime in.