open prometheus.yml: no such file or directory"

4,378 views
Skip to first unread message

maitri chattopadhyay

unread,
Dec 24, 2018, 11:31:52 PM12/24/18
to Prometheus Users
Hi,
this is the first time I am using prometheus. Please feel free to ask questions if I miss out some crucial explanation.

I am trying to install and run the prometheus server from Terminal on my Mac.

1. I installed prometheus using brew.
2. I checked the version to verify its installed. 
3. Next I navigated in to the prometheus folder. 
4. Now I am trying to start the server by using the command:  prometheus --config.file="prometheus.yml" 

This is the error I got:  
err="error loading config from \"prometheus.yml\": couldn't load configuration (--config.file=\"prometheus.yml\"): open prometheus.yml: no such file or directory"


 My understanding is that there is a default sample prometheus.yml file  when the app is installed. What m I doing wrong? 
I would also like to make changes to this file. How do I locate it and make the changes?


Hrishikesh Barman

unread,
Dec 24, 2018, 11:39:48 PM12/24/18
to Prometheus Users
Hi, 
1. I installed prometheus using brew.
2. I checked the version to verify its installed. 
3. Next I navigated in to the prometheus folder. 
4. Now I am trying to start the server by using the command:  prometheus --config.file="prometheus.yml" 

You need to put the prometheus.yml file somewhere and specify it using the `--config.file`  flag.
Message has been deleted
Message has been deleted

maitri chattopadhyay

unread,
Dec 25, 2018, 3:16:29 AM12/25/18
to Prometheus Users
Thanks for the link. 
I created a prometheus.yml file and configured it  as following. 

#Global configurations


global:

  scrape_interval:     5s # Set the scrape interval to every 5 seconds.

  evaluation_interval: 5s # Evaluate rules every 5 seconds.


scrape_configs:

  - job_name: 'prometheus'

    metrics_path: '/actuator/prometheus'

    static_configs:

      - targets: ['localhost:8080']




Now when I hit the url http://localhost:8080/graph, I get the following error.


Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Dec 25 00:13:02 PST 2018
There was an unexpected error (type=Not Found, status=404).
No message available


What am I missing?


 

Julius Volz

unread,
Dec 26, 2018, 11:19:29 AM12/26/18
to maitri chattopadhyay, Prometheus Users
Hi Maitri,

You need to use the flag "--config.file=/etc/prometheus/prometheus.yml" to make Prometheus use the configuration file you created in /etc/prometheus/prometheus.yml. Indeed, our official release archives contain a default configuration file, but I don't know how Brew installs Prometheus (Prometheus people are not involved in that). By default, if you do not provide the --config.file flag, Prometheus will look for a "prometheus.yml" in the current working directory.

As to your question about localhost:8080/graph - That is your target's hostname and port, not the Prometheus server's. Prometheus will start up on port 9090 by default, so try http://localhost:9090/.

Cheers,
Julius

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/94b56709-db85-4971-bd85-c14858d8db84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

maitri chattopadhyay

unread,
Dec 26, 2018, 1:47:06 PM12/26/18
to Prometheus Users
Hi Julius,
 
I am inside the prometheus folder. If I use the command  : prometheus --config.file=/etc/prometheus/prometheus.yml , I am getting the following error. 

level=error ts=2018-12-26T18:41:25.915715Z caller=main.go:624 err="error loading config from \"/etc/prometheus/prometheus.yml\": couldn't load configuration (--config.file=\"/etc/prometheus/prometheus.yml\"): open /etc/prometheus/prometheus.yml: no such file or directory"



So, I now I used  prometheus --config.file="prometheus.yml"  to start the server. the server started successfully, But it says listening to port 9090. While I have mentioned the port to be 8080 i the yml file. 


level=info ts=2018-12-26T18:42:09.380736Z caller=web.go:429 component=web msg="Start listening for connections" address=0.0.0.0:9090.



Since there was no prometheus.yml file before I created one, how is it still listening to 9090?



Reply all
Reply to author
Forward
0 new messages