新手安装配置Alertmanager开机自启动时Active: failed (Result: exit-code)问题
安装完成Prometheus和Grafana后,安装alertmanager时遇到的问题。
·
项目场景:
安装完成Prometheus和Grafana后,安装alertmanager时遇到的问题
问题描述
当直接cd到local文件夹下面使用./alertmanager命令可以成功运行alertmanager,但是设置开启自启动后,查看状态显示失败。
[root@Prometheus alertmanager]# vim /etc/systemd/system/alertmanager.service
[root@Prometheus alertmanager]# systemctl daemon-reload
[root@Prometheus alertmanager]# systemctl start alertmanager.service
[root@Prometheus alertmanager]# systemctl status alertmanager.service
● alertmanager.service - Prometheus Alertmanager
Loaded: loaded (/etc/systemd/system/alertmanager.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2023-08-10 15:01:54 CST; 3min 20s ago
Process: 41469 ExecStart=/usr/local/alertmanager/alertmanager --config.file="/usr/local/alertmanager/alertmanager.yml" (code=exited, status=1/FAILURE)
Main PID: 41469 (code=exited, status=1/FAILURE)
原因发现config.file="/usr/local/alertmanager/alertmanager.yml",中带有双引号,需要把双引号删除,即进行如下操作,找到loaded文件,上述日志提醒中有文件位置:
vim /etc/systemd/system/alertmanager.service
修改配置文件如下
[Unit]
Description=Prometheus Alertmanager
After=network.target
[Service]
ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml
[Install]
WantedBy=multi-user.target
再次start
[root@Prometheus alertmanager]# systemctl daemon-reload
[root@Prometheus alertmanager]# systemctl start alertmanager.service
[root@Prometheus alertmanager]# systemctl status alertmanager.service
● alertmanager.service - Prometheus Alertmanager
Loaded: loaded (/etc/systemd/system/alertmanager.service; enabled; vendor preset: disabled)
Active: active (running) since 四 2023-08-10 15:07:54 CST; 11s ago
Main PID: 41513 (alertmanager)
CGroup: /system.slice/alertmanager.service
└─41513 /usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml
访问ip+9093成功显示
更多推荐
已为社区贡献1条内容
所有评论(0)