Is there a way, to visualize firing alerts in Grafana in another way except for the Alert List panel?
What i am trying to achieve is to color a stat-panel based on the number and severity of live firing alerts. Is there a way to query alerts? Do you know of a workaround to achieve what im trying?
Or is there an efficient way to log firing and resolved alerts in a Database, which i can then query?
Thankful for any help!!!
Hi, you got me at efficient
you can use (at least in Grafana 11.6) /api/prometheus/grafana/api/v1/rules
endpoint to query the state of alerts (similarly as alert list page does). In there you’ll get all the rules from the alertmanager, so it’s quite a lot if you have lots of alerts. Use Infinity Pluign to query and parse the response and you’re good to go.
As far as I know that’s the only way to get the current alerts aside from querying the database directly (which was troublesome from what I remember).
There’s also Alert State History (on Loki, Prometheus in newer versions or annotations by default) but (at least in loki) there are only events that alerts were fired, so you’d have to make a pretty complicated query (at least from the top of my head) to get the currently firing ones.