How to get all alerting rules status via 9.X Grafana API(similar to the legacy alert api)

Is there anyway to retrieve all status of newly defined alert rules in the 9.X grafana API?

From the legacy http alert endpoint

curl -s https://127.0.0.1/api/alerts | jq -r ‘.|{“state”:.state}’

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “alerting”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

{

“state”: “ok”

}

@koyejo you can try the APIs:

http://grafana.staged-by-discourse.com/api/prometheus/grafana/api/v1/alerts
http://grafana.staged-by-discourse.com/api/prometheus/grafana/api/v1/rules

You can read more about these APIs here:
https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/pkg/services/ngalert/api/tooling/post.json

4 Likes