美文网首页
Prometheus拉取Pushgateway的Job和inst

Prometheus拉取Pushgateway的Job和inst

作者: 不语翕 | 来源:发表于2020-03-18 17:12 被阅读0次

问题

  • 推送给Pushgateway的instance和job全部加了"exported_"前缀,instance="gateway",job="pushgateway"
    现象:myCounter{exported_instance="instance1",exported_job="some_job",instance="gateway",job="pushgateway"}


    image.png

原因: 收集数据本身的 job 和 instance 被覆盖。

  • 因为 Prometheus 配置 pushgateway 的时候,也会指定 job 和 instance, 但是它只表示 pushgateway 实例,不能真正表达收集数据的含义。所以在 prometheus 中配置 pushgateway 的时候,需要添加 honor_labels: true 参数,
    从而避免收集数据本身的 job 和 instance 被覆盖。

解决方案: 添加 honor_labels: true

···

  • job_name: 'pushgateway'
    honor_labels: true
    static_configs:
    • targets: ['127.0.0.1:9091']
      labels:
      instance: gateway
      ···
      然后重启Prometheus

效果

image.png

相关文章

网友评论

      本文标题:Prometheus拉取Pushgateway的Job和inst

      本文链接:https://www.haomeiwen.com/subject/lejcyhtx.html