Configure Prometheus to use non-default port

rookie09 picture rookie09 · Nov 21, 2017 · Viewed 15.6k times · Source

I would like to install Prometheus on port 8080 instead of 9090 (its normal default). To this end I have edited /etc/systemd/system/prometheus.service to contain this line:

ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus.yaml --web.enable-admin-api \
  --web.listen-address=":8080"

I.e., I am using option --web.listen-address to specifiy the non-default port.

However, when I start Prometheus (2.0 beta) with systemctl start prometheus I receive this error message:

parse external URL "": invalid external URL "http://<myhost>:8080\"/"

So how can I configure Prometheus such that I can reach its web UI at http://<myhost>:8080/ (instead of http://<myhost>:9090)?

Answer

rookie09 picture rookie09 · Nov 21, 2017

The quotes were superfluous. This line will work:

ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus.yaml --web.enable-admin-api \
  --web.listen-address=:8080