prometheus采集数据时添加自定义标签

https://blog.51cto.com/u_14205795/4561310

1 增加自定义标签ident,标签值用__address__的ip

  - job_name: 'label_test'
    static_configs:
    - targets: ['192.168.214.151:9100']    
    relabel_configs:
    - source_labels: [__address__]
      regex: '(.*):9100'
      replacement: $1
      target_label: ident
      action: replace

新指标:

node_filesystem_avail_bytes{device="/dev/mapper/centos-root",fstype="xfs",ident="192.168.214.151",instance="192.168.214.151:9100",job="label_test",mountpoint="/"}

posted @ 2022-07-21 14:08  明天OoO你好  阅读(1640)  评论(0编辑  收藏  举报