Configure Prometheus to use non-default port

2019-02-21 01:25发布

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

1条回答
萌系小妹纸
2楼-- · 2019-02-21 01:43

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
查看更多
登录 后发表回答