我们希望从 Prometheus 服务器获取按特定标签过滤的所有指标名称。
第 1 步:使用以下查询获取所有指标名称,查询成功并获得所有指标名称。
curl -g 'http://localhost:9090/api/v1/label/__name__/values
Run Code Online (Sandbox Code Playgroud)
步骤 2 :使用以下查询获取按标签过滤的所有指标名称,但查询仍然返回所有指标名称。
curl -g 'http://localhost:9090/api/v1/label/__name__/values?match[]={job!="prometheus"}'
Run Code Online (Sandbox Code Playgroud)
有人可以帮我通过 http 按标签过滤所有指标名称吗?谢谢
curl -G -XGET http://localhost:9090/api/v1/label/__name__/values --data-urlencode 'match[]={__name__=~".+", job!="prometheus"}'
Run Code Online (Sandbox Code Playgroud)
@anemyte,仍然返回所有结果。您可以检查一下查询吗
rest curl prometheus prometheus-alertmanager prometheus-java