Nagios Message Queue


OK here is the deal…

I have a Nagios server that is on a branch of our network that gets a lot of bumps from our service provider. I am going to move it to a more stable branch as soon as some infrastructure is in place.

Until then I have to deal with the bumps (which are sometimes a couple of hours).

When I notice a bad outage I attempt to shut Nagios off ASAP. But miss it a lot and Nagios will queue 100’s of messages. when I catch it I kill Nagios but it still proceeds to send out the mail queue. Is there a way to kill the mail queue and flush it from sending anything else out?



If that is the case write a shell script to kill nagios if it cannot ping a host for example.

Run something like this in a crontab every 5 mins or so.


host="" # set to host to test ping on
nagios_bin=/path/to/nagios/binary # Set to nagios binary path.
nagios_config=/patch/to/nagios/config # Set to nagios config path.

cmd=$(/bin/ping -q -c2 $host)

if  -z "$cmd" ]; then

echo "NOT OK"

killall nagios 


echo "OK"

check_nagios=$(ps xua | grep -c 'nagios')

if  $check_nagios -eq "0" ]; then
$nagios_bin -d $nagios_config


echo "Nagios already up."