Prometheus yaml文件:未找到所需的密钥

Prometheus yaml文件:未找到所需的密钥,yaml,prometheus,Yaml,Prometheus,我不熟悉yml文件格式,我无法理解为什么在运行应用程序时会出现错误: 从“prometheus.yml”加载配置时出错:无法加载 配置(--config.file=\“prometheus.yml\”):解析YAML文件 prometheus.yml:yaml:第34行:未找到预期的密钥 这是我收到的唯一通知,没有具体说明。这是我的文件的外观: # my global config global: scrape_interval: 15s # Set the scrape inter

我不熟悉yml文件格式,我无法理解为什么在运行应用程序时会出现错误:

从“prometheus.yml”加载配置时出错:无法加载 配置(--config.file=\“prometheus.yml\”):解析YAML文件 prometheus.yml:yaml:第34行:未找到预期的密钥

这是我收到的唯一通知,没有具体说明。这是我的文件的外观:

# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']


global:
scrape_interval: 10s
evaluation_interval: 10s
- job_name: 'kafka'
  static_configs:
   - targets:
     - localhost:7071
#我的全局配置
全球的:
刮水间隔:15s#将刮水间隔设置为每15秒一次。默认值为每1分钟一次。
评估间隔:15s#每15秒评估一次规则。默认值为每1分钟一次。
#刮削超时设置为全局默认值(10秒)。
#Alertmanager配置
提醒:
警报管理员:
-静态\u配置:
-目标:
#-alertmanager:9093
#加载规则一次,并根据全局“评估间隔”定期评估规则。
规则文件:
#-“第一规则.yml”
#-“第二规则.yml”
#仅包含一个要刮取的端点的刮取配置:
#这是普罗米修斯本人。
刮取_配置:
#作业名称作为标签“job=”添加到此配置中的任何时间序列。
-工作名称:“普罗米修斯”
#metrics\u路径默认为“/metrics”
#方案默认为“http”。
静态\u配置:
-目标:['localhost:9090']
全球的:
刮除间隔:10秒
评估间隔:10秒
-工作名称:“卡夫卡”
静态\u配置:
-目标:
-本地主机:7071
是我的间距造成了错误吗?我尝试像默认文件一样复制间距。如果我在第二次全局更新后删除所有内容,它将运行。如何修复此问题?

您不能有两个“全局”部分。“刮取间隔”和“评估间隔”参数已在第一个“全局”中定义,您不需要在最后再次使用这些定义