error loading config from prometheus yml couldn t load configuration --config file prometheus yml parsing YAML file prometheus yml yaml unmarshal errors

0 votes

Hi Guys,

I am trying to start Prometheus server in my system, but I am getting some error as shown below.

$ ./prometheus
level=error ts=2020-05-27T06:42:06.463Z caller=main.go:758 err="error loading config from \"prometheus.yml\": couldn't load configuration (--config.file=\"prometheus.yml\"): parsing YAML file prometheus.yml: yaml: unmarshal errors:\n  line 30: field static_configs already set in type config.plain"

I used this below configuration file.

scrape_configs:
- job_name: 'prometheus'
  static_configs:
  - targets: ['localhost:9090']
  static_configs:
  - targets: ['10.0.2.15:9100']

 Can anyone help me with this?

May 27, 2020 in DevOps & Agile by akhtar
• 38,170 points
2,365 views

1 answer to this question.

0 votes

Hi@akhtar,

Whenever you add any node to scrape its metrics, you have to give job name for individuals. In your code you missed job name. Correct your configuration file as given below.

scrape_configs:
- job_name: 'prometheus'
  static_configs:
  - targets: ['localhost:9090']
- job_name: 'Node1'
  static_configs:
  - targets: ['10.0.2.15:9100']

Now it will not give any error.

answered May 27, 2020 by MD
• 95,060 points

Related Questions In DevOps & Agile

+1 vote
1 answer

Unable to execute the exported jar file exported from eclipse for the selenium webdriver test.

Hi Ijaz Looks like when you are executing ...READ MORE

answered Dec 3, 2019 in DevOps & Agile by Raveendiran
• 960 points
370 views
0 votes
1 answer

error no configuration has been provided kubectl

Hi@Kapil, Kubectl will mot come with minikube. You ...READ MORE

answered May 27, 2020 in DevOps & Agile by MD
• 95,060 points
279 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
949 views
+2 votes
1 answer
+3 votes
5 answers

How to run YML compose file?

You can run the following command to ...READ MORE

answered May 6, 2019 in DevOps & Agile by Mithin
69,528 views