Alertmanager email template type conversions/casting

87 views
Skip to first unread message

Clayton Bryant

unread,
May 9, 2022, 5:09:51 PM5/9/22
to Prometheus Users
I have looked all afternoon for documentation regarding type conversion or type casting using Alertmanager's templating language, but have had no luck finding anything useful. Has anyone used type conversion or casting in a template successfully? Specifically, I am looking to convert a string variable to a float or integer in order to do value comparisons.

Here's a snippet of code, though I don't think it is particularly useful:
"(gt float64(.Value) float64($disk_value))"

.Value in this case is the value of a label I have on a disk space alert. 
I want to display only the highest % disk use value in the case where multiple mountpoints have passed the alerting threshold.

Any help would be greatly appreciated. I am very new to Go, so if there is some documentation I should read, a link to that would be awesome too!

Thanks in advance.
Reply all
Reply to author
Forward
0 new messages