Reputation: 183
I am new to the yml file formatting and I cannot figure out why when I run the application, I get the error:
error loading config from \"prometheus.yml\": couldn't load configuration (--config.file=\"prometheus.yml\"): parsing YAML file prometheus.yml: yaml: line 34: did not find expected key
That is the only notification I get and there is nothing specific about it. This is what my file looks like:
# 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
Is my spacing causing the error? I tried duplicating the spacing like the default file. If I remove everything after the 2nd global, it runs. How can I fix this?
Upvotes: 4
Views: 25810
Reputation: 22321
You can't have two "global" sections. The "scrape_interval" and the "evaluation_interval" parameters are already defined in the first "global", you don't need these definitions again at the end.
Upvotes: 5