duration field in alertmanager alert notification

397 views
Skip to first unread message

mostafa khedri

unread,
Jan 17, 2023, 11:47:17 AM1/17/23
to Prometheus Users
Hi every one
I want to use telegram for alerting in Alertmanager, And I want to have a duration field in my notifications in telegram. I was using a bot in Telegram before and integrate it with Alertmanager and I had this field as below in resolved notification:


2023-01-13_21-31-52.jpg

But this bot is deprecated and I use Alertmanager self-integration with the telegram. my Alertmanager configuration is:

2023-01-13_21-31-152.jpg

But now with the use of this configuration, I don't have a duration field in my notification template anymore as below:

Screenshot 2023-01-13 2138107.jpg
How can I have a duration field in my notification? please help!!

Julius Volz

unread,
Jan 18, 2023, 9:16:29 AM1/18/23
to mostafa khedri, Prometheus Users
Hi Mostafa,

If I understand correctly, you want to change the "Since: <...>" absolute timestamp in your notification message to a relative duration. Unfortunately Alertmanager doesn't currently have any template function to change timestamps to relative duration strings, so I don't think it's possible natively with Alertmanager at the moment. Maybe it makes sense to add such a function though, not sure (if you'd like, you could try filing a feature request at https://github.com/prometheus/alertmanager/issues).

Regards,
Julius

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/a69aaab2-c939-41a8-a198-3c76af24d5c1n%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com
Reply all
Reply to author
Forward
0 new messages