【问题标题】:Configure Prometheus to use non-default port配置 Prometheus 使用非默认端口
【发布时间】:2018-05-05 00:07:12
【问题描述】:

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

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

即,我使用选项--web.listen-address 来指定非默认端口。

但是,当我使用 systemctl start prometheus 启动 Prometheus (2.0 beta) 时,我收到以下错误消息:

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

那么如何配置 Prometheus 以便我可以通过 http://&lt;myhost&gt;:8080/(而不是 http://&lt;myhost&gt;:9090)访问其 Web UI?

【问题讨论】:

    标签: http port systemd prometheus


    【解决方案1】:

    引号是多余的。此行将起作用:

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

    【讨论】:

      【解决方案2】:

      我使用的是 Ubuntu 20.02。它需要:

      --web.listen-address=:8080  #defaults to  IPv6
      --web.listen-address=*:8080 # does not work
      --web.listen-address=192.168.1.X:8080 # for IPv4
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-30
        • 2019-05-01
        • 2011-11-12
        • 1970-01-01
        • 2016-04-23
        相关资源
        最近更新 更多