when i use prometheus api to get specify rule group infomation, the api doc as following: https://prometheus.io/docs/prometheus/latest/querying/api/#rules
URL query parameters:
type=alert|record: 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.
rule_name[]=<string>: only return rules with the given rule name. If the parameter is repeated, rules with any of the provided names are returned. If we've filtered out all the rules of a group, the group is not returned. When the parameter is absent or empty, no filtering is done.
rule_group[]=<string>: only return rules with the given rule group name. If the parameter is repeated, rules with any of the provided rule group names are returned. When the parameter is absent or empty, no filtering is done.
file[]=<string>: only return rules with the given filepath. If the parameter is repeated, rules with any of the provided filepaths are returned. When the parameter is absent or empty, no filtering is done.
but when i curl the api use following three methods, it all doesn't work!
curl -s http://localhost:9090/api/v1/rules?rule_group=ec.rules
curl -s http://localhost:9090/api/v1/rules -d '{"rule_group": "ec.rules"}' -H "Content-Type: application/json"
curl -XGET -s 'http://localhost:9090/api/v1/rules' --data-urlencode "rule_group=ec.rules" -H "Content-Type: application/x-www-form-urlencoded"
curl thanos query is the same result
curl -s http://localhost:10902/api/v1/rules?rule_group=ec.rules
Anybody know any wrong when i use the curl?Or tell me how to use the prometheus/thanos api? Thanks a lot!
prometheus_version: v2.45.0
thanos_version: v0.31.0
Using latest prometheus version https://github.com/prometheus/prometheus/releases/tag/v2.47.2 can get the correct response. My example: