如何在prometheus重新标签步骤中更换标签?

时间:2016-12-19 23:02:34

标签: prometheus

我正在使用基于prometheus文件的服务发现。但是,在拉入我的服务器列表时,我意识到我的服务的指标端点是/prometheus/metrics

我已经看到我可以使用重新标记来解决这个问题。

- job_name: 'servers-dev'
  file_sd_configs:
  - files: ['/prometheus/topology.json']

  relabel_configs:
  - source_labels: [?????]
    action: replace
    target_label: __metrics_path__  #I want this to be /prometheus
    regex: (.+)

如何使用重新标记添加标签?

1 个答案:

答案 0 :(得分:2)

此处无需使用重新标记,您只需添加

即可
  metrics_path: /prometheus

到scrape配置。

要通过重新标记执行此操作:

  - target_label: __metrics_path__
    replacement: /prometheus

作为默认设置,您无需担心其他配置选项。

相关问题