Steps to reproduce:
- Create a new directory anywhere on your system: mkdir /tmp/zabbix
- Set rights on this directory: chown -R zabbix:zabbix /tmp/zabbix
- Set rights on this directory: chmod -R 777 /tmp/zabbix
- Edit Zabbix agent configuration file: vim /etc/zabbix/zabbix_agentd.conf
- Change this line (comment out the original) PidFile=/tmp/zabbix/zabbix_agentd.pid
- Try to restart agent or server service: systemctl restart zabbix-agent
- After timeout you can read this in systemctl status zabbix-agent.service: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?)
- With original settings you can ran agent
- It happens also with Zabbix Server
Result:
systemctl status zabbix-agent.service
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: activating (start) since Tue 2020-10-13 10:51:10 CEST; 13s ago
Process: 112891 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 114998 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 112549 (code=exited, status=0/SUCCESS)
Tasks: 6
CGroup: /system.slice/zabbix-agent.service
├─115000 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─115001 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─115002 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─115003 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─115004 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─115005 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
Oct 13 10:51:10 myhost.tst.local systemd[1]: Starting Zabbix Agent...
Oct 13 10:51:10 myhost.tst.local systemd[1]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) a...tory
Hint: Some lines were ellipsized, use -l to show in full.
Expected: