Zabbix agent start-up problem

From MyWiki

Jump to: navigation, search

For some reason after reboot zabbix_agentd didn't start on one of my servers. Turned out to be a missing check in start script of the agent and it was trying to create PID file in nonexistent directory:

zabbix_agentd [1583]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory


Here is a patch to fix it:

--- /root/zabbix_agentd.old	2013-06-13 10:24:48.106222648 +0100
+++ /etc/init.d/zabbix_agentd	2013-06-13 10:23:54.809362651 +0100
@@ -15,6 +15,14 @@
 
 set -e
 
+if [ "$1" != status ]; then
+	# be sure there is a /var/run/zabbix, even with tmpfs
+	if [ ! -d /var/run/zabbix ]; then
+		mkdir --mode 750 --parents /var/run/zabbix
+		chown zabbix:zabbix /var/run/zabbix
+	fi
+fi
+
 case "$1" in
   start)
 	echo "Starting $DESC: $NAME"
Personal tools