Adding remote targets in prometheus.yml
-
hello everyone, I have installed Prometheus and now I want to add more targets to the prometheus.yml.
To do this, I open the file prometheus.yml in this path:
/home/yellowtent/appsdata/97a95880-aba9-44ad-bcda-237c3c433880/data/configi add this
- job_name: <SYSTEM-NAMEN>
scrape_interval: 5s
static_configs:
- targets: ['<MY-IP:9100']
after restart the Prometheus didn't start again. i see the changes in the file manager.
when I remove the lines again, everything works fine again. What am I doing wrong? Can you please help me?
Thank you in advance, Felix
- job_name: <SYSTEM-NAMEN>
-
Firstly I would advice to edit the file with the Cloudron Filemanager not directly in the root / as root from the system level.
-
Hello and thank you very much for the quick response from you. Editing the file in the ROOT system as well as with the File Manager has the same effects. Here is the log file: thank you very much felix
2023-12-18T06:55:40.000Z => Starting Prometheus
2023-12-18T06:55:40.000Z ts=2023-12-18T06:55:40.840Z caller=main.go:487 level=error msg="Error loading config (--config.file=/app/data/config/prometheus.yml)" file=/app/data/config/prometheus.yml err="parsing YAML file /app/data/config/prometheus.yml: yaml: line 31: did not find expected key"
2023-12-18T06:55:43.000Z => Source custom variables for cli args
2023-12-18T06:55:43.000Z => Starting Prometheus
2023-12-18T06:55:43.000Z ts=2023-12-18T06:55:43.655Z caller=main.go:487 level=error msg="Error loading config (--config.file=/app/data/config/prometheus.yml)" file=/app/data/config/prometheus.yml err="parsing YAML file /app/data/config/prometheus.yml: yaml: line 31: did not find expected key"
2023-12-18T06:55:47.000Z => Source custom variables for cli args
2023-12-18T06:55:47.000Z => Starting Prometheus
2023-12-18T06:55:47.000Z ts=2023-12-18T06:55:47.269Z caller=main.go:487 level=error msg="Error loading config (--config.file=/app/data/config/prometheus.yml)" file=/app/data/config/prometheus.yml err="parsing YAML file /app/data/config/prometheus.yml: yaml: line 31: did not find expected key" -
please post your
yaml
with removed / redacted sensitive information in a code block and not plain.
You can also always usee.g. :
job_name: <SYSTEM-NAMEN> scrape_interval: 5s static_configs: - targets: ['<MY-IP:9100']
yamllint is also a great to to check if you
yaml
file is valid.