7

I would like to run Prometheus with a specific IP address. By default, it is running on localhost. I don't see any such option in the prometheus configuration

Dinesh Reddy
  • 775
  • 1
  • 11
  • 25
  • maybe you should expand your question (but I don't have an answer; I'm also struggling with making prometheus load from a specific path, not root). The prometheus documentation is quite bad – Rafa Jun 17 '19 at 11:44

2 Answers2

16

You can use the command line option for configuring your listen address

./prometheus --web.listen-address="0.0.0.0:9090" 
Nithin
  • 1,065
  • 8
  • 15
  • 2
    thanks. But is there any way to give it in the promethues yml config file? – Dinesh Reddy Apr 14 '19 at 10:54
  • 4
    from [an old google groups thread](https://groups.google.com/d/msg/prometheus-users/vX5XAgfGjp4/CDXK-ueTAAAJ): _"No, the configuration file is for options that can change dynamically. Changing the listen address is not possible on the fly."_ – Rafa Jun 17 '19 at 11:46
7

If you're using the packages for Debian-based systems, you can persistently modify the command line argument --web.listen-address in /etc/default/prometheus (and same for /etc/default/prometheus-node-exporter).

You can change both the address to be bound (e.g. blank (0.0.0.0) or 127.0.0.1 or 192.168.xx.xx) and the port number (e.g. 9090) here (e.g. :9090 or 127.0.0.1:9090).

It will look like:

# Set the command-line arguments to pass to the server.
ARGS="--web.listen-address=127.0.0.1:9090"

(Don't forget to systemctl restart prometheus prometheus-node-exporter afterward.)

Kai Ninomiya
  • 156
  • 2
  • 6