Returns currently loaded rules
GET {{baseUrl}}/rules?type=alert
The /rules
API endpoint returns a list of alerting and recording rules that are currently loaded. In addition it returns the currently active alerts fired by the Prometheus instance of each alerting rule.
As the /rules
endpoint is fairly new, it does not have the same stability guarantees as the overarching API v1.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
type | string | Return only the alerting rules (e.g. type=alert ) or the recording rules (e.g. type=record ). When the parameter is absent or empty, no filtering is done. | |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Accept | string |
RESPONSES
status: OK
{"data":{"groups":[{"rules":[{"alerts":[{"activeAt":"2018-07-04T18:27:12.606Z","annotations":{"summary":"High request latency"},"labels":{"alertname":"HighRequestLatency","severity":"page"},"state":"firing","value":1}],"annotations":{"summary":"High request latency"},"duration":600,"health":"ok","labels":{"severity":"page"},"name":"HighRequestLatency","query":"job:request_latency_seconds:mean5m{job=\"myjob\"} \u003e 0.5","type":"alerting"},{"health":"ok","name":"job:http_inprogress_requests:sum","query":"sum by (job) (http_inprogress_requests)","type":"recording"}],"file":"/rules.yaml","interval":60,"name":"example"}]},"status":"success"}