View Full Version : [SOLVED] Zabbix-Server mysql not starting at boot
maxxer
October 18th, 2010, 08:26 AM
I recently installed an Ubuntu 10.04LTS server.
I have zabbix-server on that machine, and I noticed that after reboot it won't start.
Probabily, the mix of upstart and old init.d scripts result in zabbix starting when mysql is not active yet, in fact in zabbix-server.log I see it cannot reach db.
How can I make sure zabbix-server waits for mysql?
thanks
dspano
November 22nd, 2010, 06:41 PM
I did the following to get it to work correctly.
sudo update-rc.d -f mysql remove
sudo update-rc.d mysql defaults
The first command removes all mysql start up scripts and the second one recreates them.
I found this listed at this forum post:
http://ubuntuforums.org/archive/index.php/t-1053774.html
In my case, the symlinks for the rcX.d directories were not created. Creating them with those series of commands fixed my problem.
I hope this helps.
troffasky
December 15th, 2010, 11:44 AM
I have this problem too. All the rcX directories and symlinks have been created [that's how the zabbix server service gets started], but it happens before MySQL has started.
When upstart and init are mixed together, what determines the order in which services are started?
honeydew
February 10th, 2011, 05:37 AM
dunno if your still looking, but would this be the fix http://www.zabbix.com/forum/showthread.php?t=19781
maxxer
February 10th, 2011, 09:21 AM
dunno if your still looking, but would this be the fix http://www.zabbix.com/forum/showthread.php?t=19781
great, thanks!
gnagnibu
May 31st, 2011, 09:09 AM
Hi all!
This problem affected me too, but I'm in trouble with upstart configuration.
As zabbix forum says, I've created
/etc/init/zabbix-server.conf
# zabbix-server - Start zabbix server description "Zabbix Server"
author "S. CANCHON"
pre-start script
ZabbixConfig=/etc/zabbix/zabbix_server.conf
DBuser=""
DBpassword=""
if [ -f $ZabbixConfig ]
then
DBuser=`cat $ZabbixConfig | grep '^DBUser='`
DBuser="${DBuser##*=}"
DBpassword=`cat $ZabbixConfig | grep '^DBPassword='`
DBpassword="${DBpassword##*=}"
if [ -n "$DBuser" ] && [ -n "$DBpassword" ]
then
i=0
while [ i -le 5 ]
do
Test=`mysqladmin -u$DBuser -p$DBpassword ping|grep alive|wc -l`
if [ $Test=1 ]
then
i=100
else
sleep 5
i=`expr $i + 1`
fi
done
fi
fi
end script
start on (runlevel [2345] and started mysql)
stop on runlevel [016]
respawn
expect daemon
exec /usr/sbin/zabbix_server
and /etc/init/zabbix-agent.conf
# zabbix-agent - Start zabbix agent
description "Zabbix Agent"
author "S. CANCHON"
start on runlevel [2345]
stop on runlevel [016]
respawn
expect daemon
exec /usr/sbin/zabbix_agentd
Next I removed zabbix-* scripts from /etc/rc.* with
update-rc.d -f zabbix-server remove
update-rc.d -f zabbix-agent remove
but next reboot, Zabbix-* don't start
Any ideas?
gnagnibu
May 31st, 2011, 09:48 AM
/var/log/syslog says:
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2003) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2007) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2011) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2015) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2019) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2023) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2027) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2031) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2035) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2039) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process ended, respawning
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server main process (2043) terminated with status 255
May 31 10:48:07 SAERUBUNTU003 init: zabbix-server respawning too fast, stopped
gnagnibu
May 31st, 2011, 10:14 AM
Both /var/log/zabbix-server/zabbix_server.log and /var/log/zabbix-server/zabbix_agentd.log say that processes were unable to create PID.
The solution is to modify /etc/init/zabbix-server.conf and /etc/init/zabbix-agent.conf in order to create pids directory.
For right configurations files see attchments
Bye!
RayVad
June 1st, 2011, 11:17 AM
Many thanks gnagnibu. Running fine here too!
gnagnibu
June 1st, 2011, 12:58 PM
Great!
gnagnibu
June 22nd, 2012, 10:19 AM
I improved my zabbix-server.conf file to check if MySQL can accept connections before starts zabbix:
description "Zabbix Server"
author "Vecchi Giovanni"
pre-start script
if [ ! -d /var/run/zabbix-server ]; then
mkdir -p /var/run/zabbix-server
chown zabbix:zabbix /var/run/zabbix-server
chmod 755 /var/run/zabbix-server
fi
ZabbixConfig=/etc/zabbix/zabbix_server.conf
DBUser=""
DBPassword=""
DBName=""
if [ -f $ZabbixConfig ]
then
DBUser=`cat $ZabbixConfig | grep '^DBUser='`
DBUser="${DBUser##*=}"
DBPassword=`cat $ZabbixConfig | grep '^DBPassword='`
DBPassword="${DBPassword##*=}"
DBName=`cat $ZabbixConfig | grep '^DBName='`
DBName="${DBName##*=}"
if [ -n "$DBUser" ] && [ -n "$DBPassword" ]
then
while [ ! -S /var/run/mysqld/mysqld.sock ]
do
sleep 1
done
i=0
while [ $i -le 5 ]
do
mysql -u$DBUser -p$DBPassword $DBName -e "SELECT \"1\"" &> /dev/null
MYSQL_EXIT_CODE=$?
if [ $MYSQL_EXIT_CODE=0 ]
then
i=6
else
sleep 5
i=`expr $i + 1`
fi
done
fi
fi
end script
start on (runlevel [2345]
and started mysql)
stop on runlevel [016]
respawn
expect daemon
exec /usr/sbin/zabbix_server
It works on Ubuntu 10.04.4
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.