Fetch only first element in alertmanager.yml

18 views
Skip to first unread message

Harsh Kumar Palsania

unread,
Feb 18, 2021, 11:43:57 AM2/18/21
to prometheus...@googlegroups.com
Hi,

I was looking for to fetch only first alert from all received alerts in alertmanager.yml file.
Is there a way we can achieve this?

I was doing this, but it's iterating through all alerts in the loop:

[{{ .Alerts.Firing | len }}] {{ range .Alerts -}} {{ if eq .Labels.problem_name "OPENF" }} Open alerts {{ end }}  {{ end }}

Thanks,
Harsh Kumar
Reply all
Reply to author
Forward
0 new messages