本文介绍了配置Prometheus以使用非默认端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在端口8080上安装Prometheus而不是9090(正常默认值)。为此我编辑了 /etc/systemd/system/prometheus.service 来包含这一行:

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"

即我正在使用期权 - web.listen-address 指定非默认端口。

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

然而,当我启动Prometheus(2.0 beta)时)与 systemctl start prometheus 我收到此错误消息:

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\"/"



http://< myhost>:8080 / (而不是>中访问其Web UI http://< myhost>:9090 )?

推荐答案

报价是多余的。行将起作用:

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

这篇关于配置Prometheus以使用非默认端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 11:46