在prometheus配置中,需要将目标和json作为参数传递给Json导出器

时间:2019-04-16 06:28:36

标签: prometheus prometheus-operator

我有一个使用prometheus运算符的prometheus设置。我已经配置了一个黑盒导出器,以使用prometheus监视某些URL。类似地,我实现了一个json导出器,用于从json url路径获取指标。我的配置如下:

src/main/webapp/WEB-INF

1 个答案:

答案 0 :(得分:0)

我已解决此问题。修改配置如下;

  metrics_path: /probe
  params:
    jsonpath: [$.details.db.details.hello] # 
  static_configs:
    - targets:
      - https://URL path
  relabel_configs:
        - source_labels: [__address__]     # set param 'target' to the original target
          target_label: __param_target
          replacement: ${1}
        - source_labels: [__param_target]  # set label 'instance' to it as well
          target_label: instance
          replacement: ${1}
        - target_label: __address__
          replacement: jsonexporter:9116```