1

我正在使用基于 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: (.+)

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

4

1 回答 1

2

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

  metrics_path: /prometheus

到刮配置。

要通过重新标记来做到这一点,你会这样做:

  - target_label: __metrics_path__
    replacement: /prometheus

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

于 2016-12-19T23:35:41.977 回答