即使使用其他端口也无法启动Prometheus

时间:2020-04-06 07:30:57

标签: prometheus

我的普罗米修斯配置如下所示

cat /etc/prometheus/prometheus.yml |grep targets
    - targets:
    - targets: ['localhost:10090']

不幸的是, / var / log / messages 报告如下错误

Apr  6 17:04:57 ip-172-31-14-101 prometheus: level=error ts=2020-04-06T07:04:57.638Z caller=main.go:747 err="error starting web server: listen tcp 0.0.0.0:9090: bind: address already in use"
Apr  6 17:04:57 ip-172-31-14-101 systemd: prometheus.service: main process exited, code=exited, status=1/FAILURE
Apr  6 17:04:57 ip-172-31-14-101 systemd: Unit prometheus.service entered failed state.
Apr  6 17:04:57 ip-172-31-14-101 systemd: prometheus.service failed.

Chef使用端口9090,因此我正在使用端口10090。我需要更新任何默认配置吗?缺少什么?

主机操作系统是Amazon Linux 2

1 个答案:

答案 0 :(得分:1)

target规范不是聆听的地方,而是从中收集指标的地方。

您要修改的是监听地址。 man页面列出了命令行选项--web.listen-address="0.0.0.0:9090",您可以更改命令行或适当地修改配置文件。

哦,here,有人已经回答了一个类似的问题,并且给出了更好的答案。建议的配置文件更改为:

# Set the command-line arguments to pass to the server.
ARGS="--web.listen-address=localhost:10090"

我在Google上搜索了prometheus listen port config,并找到了答案。您应该先问一下,我先问一下。