Restarting Nagios
Posted: Fri Jun 10, 2016 9:28 am
Whenever we apply new config, the Nagios service gets restarted.
But we have seen in the past that when the nagios service gets restarted, the nagios service does not gets correctly restarted
This results in more process running and then Nagios deamon eventually crashes.
in the init script /etc/init.d/nagios we can see that the function to kill nagios is as below
killproc_nagios ()
{
kill -s "$1" $NagiosPID
}
Ideally we should see only 2 process running when we grep the below
# ps -ef | grep nagios.cfg
root 4367 3975 0 10:24 pts/0 00:00:00 grep nagios.cfg
nagios 18181 1 35 08:50 ? 00:33:25 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 18351 18181 0 08:50 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
We tried updating the init script to "killall -9 nagios", but it did not help.
So whenever the nagios service is restarted, we need to make sure that all the pids shown above (18181, 18351 ) are killed first and then the start script should kick in.
Nagios version : 5.2.7
But we have seen in the past that when the nagios service gets restarted, the nagios service does not gets correctly restarted
This results in more process running and then Nagios deamon eventually crashes.
in the init script /etc/init.d/nagios we can see that the function to kill nagios is as below
killproc_nagios ()
{
kill -s "$1" $NagiosPID
}
Ideally we should see only 2 process running when we grep the below
# ps -ef | grep nagios.cfg
root 4367 3975 0 10:24 pts/0 00:00:00 grep nagios.cfg
nagios 18181 1 35 08:50 ? 00:33:25 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 18351 18181 0 08:50 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
We tried updating the init script to "killall -9 nagios", but it did not help.
So whenever the nagios service is restarted, we need to make sure that all the pids shown above (18181, 18351 ) are killed first and then the start script should kick in.
Nagios version : 5.2.7