Экспортеру Json необходимо передать цель и JSON в качестве параметра в конфигурации Prometheus. - PullRequest
0 голосов
/ 16 апреля 2019

У меня есть настройка Prometheus, использующая оператор Prometheus. Я настроил экспортер черного ящика для мониторинга некоторых URL-адресов с помощью Prometheus. Аналогичным образом я реализовал экспортер json для получения метрик по пути URL-адреса json. Моя конфигурация следующая:

  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?

1 Ответ

0 голосов
/ 16 апреля 2019

Я исправил проблему.Модифицировал конфигурацию следующим образом:

  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```
...