解组错误:无法将 !!seq 解组为 config.ScrapeConfig

unmarshal errors: cannot unmarshal !!seq into config.ScrapeConfig

我正在尝试设置我的 Prometheus YAML 文件以包含代理选项。如配置文档所示,应该是:

[ proxy_url: <string> ]

我尝试以各种方式将其添加到我非常基本的 YAML 文件中,但是 promtool check config prometheus.yml 给了我:

 FAILED: parsing YAML file prometheus.yml: job_name is empty

或:

 FAILED: parsing YAML file prometheus.yml: yaml: unmarshal errors:
 line 13: cannot unmarshal !!seq into config.ScrapeConfig

作为错误信息。 我的 .yml 文件当前看起来像这样并产生第二条错误消息:

global:
  scrape_interval:     15s
  evaluation_interval: 15s

rule_files:
  # - "first.rules"
  # - "second.rules"
 
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
     - targets: ['localhost:8000']
  - [ proxy_url: http://placeholderForProxy ]

我该如何解决这个问题?

试试这个:

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
     - targets: ['localhost:8000']
    proxy_url: http://placeholderForProxy