如何在Prometheus中同时满足多个条件的情况下删除时间序列?

huangapple go评论51阅读模式
英文:

How to delete series that meet multiple conditions at the same time in prometheus?

问题

以下查询对于所有具有instances=127.0.0.1:9090都有效:

curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?match[]={instance="127.0.0.1:9090"}'

以下查询对于所有具有job=node都有效:

curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?&match[]={job="node"}'

如果我只想删除具有instance=127.0.0.1:9090job=node的系列,我应该如何查询?

英文:

Following query works for all with instances=127.0.0.1:9090:

curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?match[]={instance="127.0.0.1:9090"}'

Following query works for all with job=node:

curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?&match[]={job="node"}'

If I just want to delete series with instance=127.0.0.1:9090 and job=node, how can I query it?

答案1

得分: 0

使用以下查询:

curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?match[]={instance="127.0.0.1:9090", job="node"}'

英文:

Use the following query:

curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?match[]={instance="127.0.0.1:9090", job="node"}'

huangapple
  • 本文由 发表于 2023年2月6日 18:11:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359912.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定