I am trying to configure a YAML using oauth2.0 and I keep getting a "Could not find expected ':'" error on the line towards the end that says "scopes."
# 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:
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: '/actuator/prometheus'
#scheme defaults to 'http'.
static_configs:
- targets: ["localhost:8080"]
oauth2:
client_id: ''
[ client_secret: '']
scopes:
[ - '']
token_url: ''
#tls_config:
Your YAML is invalid.
I find the Prometheus config documentation confusing to read.
In this case, you're misreading [ ... ]
. It's used to denote that something is optional in the documentation. The [
and ]
should not be literally included in your YAML.
Use a tool like yamllint
to validate your YAML.
So, try:
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
rule_files: []
scrape_configs:
- job_name: "prometheus"
metrics_path: "/actuator/prometheus"
static_configs:
- targets: ["localhost:8080"]
oauth2:
client_id: ""
client_secret: ""
scopes: []
token_url: ""
Notes:
client_secret
or client_secret_file
.# ...
) are fine.[]
). You will likely need to fix those; you're probably going to need at least one scope, for example."
or '
to delimit strings; I've used "
in the above.[]
). Again, it's good to be consistent and stick with one. The following are equivalent:JSON-way:
some-list: ["a","b","c"]
YAML-way:
some-list:
- "a"
- "b"
- "c"