如何在Prometheus中每个指标上的实例标签中映射属性值

时间:2019-06-06 10:27:18

标签: jmx prometheus jmx-exporter

我正在尝试检索属性并将其映射到JMX导出器的每个指标上 例如,我有以下内容:

ExchangesCompleted{context="esb-demo-consumer-esb-demo-consumer-context",processor="log3",type="processor",} 0.0
ExchangesCompleted{context="esb-demo-consumer-esb-demo-consumer-context",route="JMS reader",type="route",} 0.0
StartLevel{container="cnt-01-development",name="StartLevel",type="karaf",} 100.0

我想检索容器“ cnt-01-development”,并在每个指标中将实例替换为仅在 StartLevel 行中显示的内容“ cnt-01-development”。

>

它应该得到类似的东西:

ExchangesCompleted{context="esb-demo-consumer-esb-demo-consumer-context",processor="log3",type="processor",instance="cnt-01-development"} 0.0
ExchangesCompleted{context="esb-demo-consumer-esb-demo-consumer-context",route="JMS reader",type="route",instance="cnt-01-development"} 0.0
StartLevel{container="cnt-01-development",name="StartLevel",type="karaf",instance="cnt-01-development"} 100.0

我尝试了以下方法:

metric_relabel_configs:
      - source_labels: ['container']
        target_label: instance
        replacement: $1

但它仅替换StartLevel指标

0 个答案:

没有答案