0

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

  metrics_path: /probe
  params:
    jsonpath: [$.details.db.details.hello] # Look for the nanoseconds field
  static_configs:
    - targets:
      - https://URL path
  relabel_configs:
    - source_labels: [__address__]
      target_label: __param_target
    - source_labels: [__param_target]
      target_label: instance
    - target_label: __address__
      replacement: jsonexporter:9116  # Json exporter.
  metric_relabel_configs:
    - source_labels: value
      target_label:  hello``` 



But the issue is, getting error while reloading the Prometheus as follows:

level=error ts=2019-04-16T06:05:24.395218368Z caller=main.go:597 err="Error loading config couldn't load configuration (--config.file=/etc/prometheus/config_out/prometheus.env.yaml): parsing YAML file /etc/prometheus/config_out/prometheus.env.yaml: yaml: unmarshal errors:\n  line 3871: cannot unmarshal !!str `value` into model.LabelNames"

Cam someone help me to correct this?
4

1 回答 1

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```
于 2019-04-16T08:00:03.000 回答