【linux-zabbix】zabbix-agent启动报错:Daemon never wrote its PID file. Failing.

文章描述了一台系统中ZabbixAgent无法启动的问题,原因在于无法创建和写入日志文件。通过检查日志,发现问题出在权限设置上,解决方案是在缺少的目录下创建log文件并设置正确的所有者。最后,建议重启ZabbixAgent服务以应用更改。
摘要由CSDN通过智能技术生成

背景:

发现有部分的agent失联,排查发现机器正常,agent没起来。

排查日志发现:

# journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has begun starting up.
8月 02 17:59:43 gz-cs-gpu-3-104 systemd[1]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
8月 02 17:59:43 gz-cs-gpu-3-104 zabbix_agentd[30933]: zabbix_agentd [30942]: cannot open "/var/log/zabbix/zabbix_agentd.log": [2] No such file or directory
8月 02 17:59:43 gz-cs-gpu-3-104 systemd[1]: Daemon never wrote its PID file. Failing.
8月 02 17:59:43 gz-cs-gpu-3-104 systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has failed.
-- 
-- The result is failed.
8月 02 17:59:43 gz-cs-gpu-3-104 systemd[1]: Unit zabbix-agent.service entered failed state.
8月 02 17:59:43 gz-cs-gpu-3-104 systemd[1]: zabbix-agent.service failed.
8月 02 17:59:46 gz-cs-gpu-3-104 systemd[1]: Removed slice User Slice of zabbix.
-- Subject: Unit user-996.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-996.slice has finished shutting down.
8月 02 17:59:46 gz-cs-gpu-3-104 kubelet[3101]: E0802 17:59:46.702184    3101 dns.go:157] "Nameserver limits exceeded" err="Nameserver limits were exceeded, some nameservers have been omitted, the applied 
8月 02 17:59:48 gz-cs-gpu-3-104 polkitd[1365]: Registered Authentication Agent for unix-process:31997:1381929198 (system bus name :1.1999165 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /or
8月 02 17:59:48 gz-cs-gpu-3-104 systemd[1]: Stopped Zabbix Agent.
-- Subject: Unit zabbix-agent.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has finished shutting down.
8月 02 17:59:48 gz-cs-gpu-3-104 systemd[1]: Starting Zabbix Agent...
-- Subject: Unit zabbix-agent.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has begun starting up.
8月 02 17:59:48 gz-cs-gpu-3-104 systemd[1]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
8月 02 17:59:48 gz-cs-gpu-3-104 zabbix_agentd[32011]: zabbix_agentd [32013]: cannot open "/var/log/zabbix/zabbix_agentd.log": [2] No such file or directory
8月 02 17:59:48 gz-cs-gpu-3-104 systemd[1]: Daemon never wrote its PID file. Failing.
8月 02 17:59:48 gz-cs-gpu-3-104 systemd[1]: Failed to start Zabbix Agent.

发现是没有权限创建log文件,这个log文件是配置文件指定,要提前创建目录和文件以及权限所属配置zabbix,我这里是/var/log/zabbix/zabbix_agentd.log

mkdir /var/log/zabbix && touch /var/log/zabbix/zabbix_agentd.log && chown -R zabbix:zabbix /var/log/zabbix

systemctl restart zabbix-agent

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值