Prometheus 排除特定的指标

软件版本

使用 helm 部署
CHART 版本 prometheus-25.4.0
APP VERSION 2.47.2

背景

只想保留 cpu="0" 的记录

node_cpu_guest_seconds_total{cpu="0", group="hosts", instance="172.16.16.10:9100", job="docker-hosts", mode="nice"} 

修改

在 my-values.yaml 中修改

vi my-values.yaml
# 添加下面配置
        metric_relabel_configs:
          - source_labels: [cpu]
            regex: '[1-9]' 
            action: drop

# 升级,不需要重启 pod,配置会过一会生效
helm -n monitoring upgrade prometheus -f my-values.yaml ./prometheus

检查


已生效

posted @ 2024-11-13 17:38  klvchen  阅读(58)  评论(0)    收藏  举报