1

I have a stack where I create alerts in Prometheus. These alerts are listed under Grafana > Alert > Alert Rules.

I wanted to create a dashboard where I could view the alerts in a simple way. Like normal and firing status.

2 Answers2

1

You can query alert in firing or pending status with metric ALERTS.

It will return metric of the following format:

ALERTS{alertname="Watchdog", alertstate="firing", severity="warning"} 1

But, as far as I know, you cannot query alerts in passive state.

If you really want all alerts, you could get them from rules with the request to api/v1/rules?type=alert, but you'll need JSON plugin for this.

markalex
  • 8,623
  • 2
  • 7
  • 32
  • Do you have any example and some dashboard that I can use? – Pablo Marques Jun 30 '23 at 19:01
  • @PabloMarques, sorry, it is not clear, what kind of example do you expect? Create Table panel with query `ALERTS`, and you'll see alerts. Or do you want [link to dashboard](https://grafana.com/grafana/dashboards/11098-alerts/) in store? – markalex Jun 30 '23 at 19:10
  • I was looking for an example, but I racked my brain thinking and I managed to do it :) – Pablo Marques Jul 01 '23 at 02:52
0

Steps:

  • Install Plugin Json API in Grafana. "Versions above 1.3.3 had some issues."
  • Create Data Source in Grafana .

result