重新标记prometheus中的实例名称

时间:2017-10-03 15:06:17

标签: prometheus

我试图重新标记普罗米修斯的__address__财产而没有任何运气。这是我的配置:

      - job_name: 'kafka'
        scrape_interval: 10s
        static_configs:
          - targets:
            - kafka-kafka-0.kafka-kafka-headless:5556
            - kafka-kafka-1.kafka-kafka-headless:5556
            - kafka-kafka-2.kafka-kafka-headless:5556
            - kafka-kafka-3.kafka-kafka-headless:5556
            - kafka-kafka-4.kafka-kafka-headless:5556
            - kafka-kafka-5.kafka-kafka-headless:5556
        relabel_configs:
          - source_labels: [__address__]
            regex: '(.+)\.'
            target_label: instance
            replacement: ${1}

我想要实现的是获取地址标签并制作像kafka-kafka-0kafka-kafka-1等实例标签......但它不能按预期工作

1 个答案:

答案 0 :(得分:2)

Prometheus正则表达式已锚定,因此您的正则表达式不匹配。最后添加.*