如何重启普罗米修斯?

How to restart prometheus?

我已经在我的 Ubuntu 机器上安装了 prometheus,它现在正在 运行ning localhost:9090。但是,当我 运行 以下命令时,我得到一个失败状态。

systemctl status prometheus

输出:

● prometheus.service - Prometheus
Loaded: loaded (/lib/systemd/system/prometheus.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-11-06 14:58:36 +0530; 8s ago
Main PID: 7046 (code=exited, status=1/FAILURE)

නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Service hold-off time over, scheduling restart
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5
නෙවැ 06 14:58:36 ayesh systemd[1]: Stopped Prometheus.
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Start request repeated too quickly.
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Failed with result 'exit-code'.
නෙවැ 06 14:58:36 ayesh systemd[1]: Failed to start Prometheus.

我尝试使用以下方式重新启动 prometheus;

killall -HUP prometheus
sudo systemctl daemon-reload
sudo systemctl restart prometheus

并使用;

curl -X POST http://localhost:9090/-/reload

但它们对我不起作用。我已经使用 'promtool' 检查了 prometheus.yml 的语法错误并且它成功通过了。

还有其他方法可以解决这个问题吗?

检查它是否仍在您的任务管理器上 运行,然后从那里终止它的任务,这样就可以了。

输出显示 prometheus 启动失败。所以你不应该杀死任何东西。只需检查您的流程:

ps -ef | [p]rometheus   # the [p] is used to hide the grep process itself 

使用以下命令查看更多关于prometheus的日志内容:

journalctl -t prometheus

目录 /var/log 中的日志文件中可能还有更多信息,尤其是 /var/log/messages and/or /var/log/syslog.

出于调试目的,只需通过执行以下命令在前台启动 prometheus:

$(which prometheus)

这将有助于找到有关失败启动的更多信息。