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.
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.