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. https://prometheus.io/docs/alerting/notifications/#alert https://golang.org/pkg/text/template/ Kind regards, Christian > בתאריך יום רביעי, 11 במרץ 2020 בשעה 23:01:54 UTC+2, מאת Christian Hoffmann: > > Hi, > > On 3/11/20 2:45 PM, eyal trigerman wrote: > > 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 > > 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 > > -- > 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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/b60cb6d3-44a2-4065-8858-d10f21c009eb%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/b60cb6d3-44a2-4065-8858-d10f21c009eb%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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/c54ba96b-b611-6e50-aba1-4513cbdfb7ec%40hoffmann-christian.info.

