【问题标题】:Prometheus relabel_configs issuePrometheus relabel_configs 问题
【发布时间】:2022-12-17 04:12:27
【问题描述】:

我的标签:

__address__: "https://example.com/health"
__metrics_path__: "/probe"
__param_module: "http_200"
__scheme__: "http"
job: "black-box"

我的配置:

relabel_configs:
  - source_labels: [__address__]
    target_label: __param_target
  - source_labels: [__param_target]
    target_label: instance
  - source_labels: [__address__]
    regex:  '\/health'
    replacement: 'my new label'
    target_label: service
  - source_labels: [module]
    target_label: __param_module
  - target_label: __address__
    replacement: newdomain:9115

我不明白为什么 regex: '\/health' 不匹配并且没有创建服务目标。

谢谢

【问题讨论】:

    标签: prometheus prometheus-blackbox-exporter


    【解决方案1】:

    regex 应该匹配整个字符串,它由传递给 source_labels 列表的标签值与 separator 连接而成(默认设置为 ;)。所以,在你的情况下, regex 应该看起来像 regex: ".+/health"

    附言我建议使用this service for debugging of Prometheus target relabeling

    【讨论】:

      猜你喜欢
      • 2022-12-17
      • 1970-01-01
      • 1970-01-01
      • 2022-08-14
      • 2023-02-15
      • 1970-01-01
      • 1970-01-01
      • 2019-05-31
      • 2021-04-30
      相关资源
      最近更新 更多