如果 prometheus 在 mac 上作为服务运行,如何更新配置文件?

问题描述 投票:0回答:3

如果 prometheus 在 mac 上作为服务运行,如何更新 prometheus.yml 文件? 请分享在 mac 上更新 prometheus prometheus.yml 文件的命令。

prometheus grafana
3个回答
7
投票

如果您使用brew安装了prometheus,并使用

brew services start prometheus
运行 你可以编辑
/usr/local/etc/prometheus.yml
中的配置文件,然后你可以使用命令
brew services restart prometheus

重新启动prometheus

7
投票

我的配置文件位于不同的目录中:

/opt/homebrew/etc/prometheus.yml

安装后有一些帮助文本,参数在此处设置

/opt/homebrew/etc/prometheus.args

args 有一个配置文件所在位置的键:

--config.file /opt/homebrew/etc/prometheus.yml
--web.listen-address=127.0.0.1:9090
--storage.tsdb.path /opt/homebrew/var/prometheus

0
投票

我也尝试自己找,终于在

/opt/homebrew/etc/prometheus.yml
找到了。但我认为这不是找到它的好方法,因为可能会应用不同的约定。

我建议直接检查

http://localhost:9090/flags
(如果您部署在本地的其他域中,请替换它)。然后你会看到用于启动的所有标志,然后你可以尝试找到
--config.file
标志,它显示了它使用的配置文件。

© www.soinside.com 2019 - 2024. All rights reserved.