Dinesh Reddy
Dinesh Reddy

Reputation: 825

How to configure a specific IP in prometheus yml configuration file?

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

Upvotes: 10

Views: 22761

Answers (2)

Nithin
Nithin

Reputation: 1105

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

./prometheus --web.listen-address="0.0.0.0:9090" 

Upvotes: 19

Kai Ninomiya
Kai Ninomiya

Reputation: 167

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.)

Upvotes: 8

Related Questions