Nagios kept from restarting after reboot by lockfile

Andreas Ericsson ae at op5.se
Tue Dec 21 08:34:27 CET 2010


On 12/21/2010 01:58 AM, eric.berg at barclayscapital.com wrote:
> We reboot all of our hosts on a weekly basis.  I used to price myself in keeping my boxes up as long as possible, but having spent years now supporting mission-critical financial production applications, I'm on board with the weekly reboots.  Lets you know early if some system or app change is problematic.
> 
> Reboot is being done via a standard reboot command.
> 
> I've looked around for rc scripts that might address this issue, but haven't found any.  Got any pointers?
> 
> Regarding the rc.local solution, a) I'd prefer to solve the problem, not just address the symptoms, and b) elsewhere in this thread I've described the roadblocks that we have to doing anything a system level.  Yep, that's right, boys, we survive in the app developer layer within which we do not have root on these boxes.  It's a tedious, time-consuming, frustrating, productivity-killing endeavor to do just about anything you can't do yourself.
> 
> So....got any sample RC scripts, or command line params to nagios to make it smart enough to know that the PID that is in it's PID file isn't an active process?
> 

Depending on what system tools you've got installed, this should work
decently. Set variables to proper values and add it to the top of your
init script.

pid=$(cat $lockfile)
kill -0 $pid || rm -f $lockfile
nagiospid=$(pidof nagios | sed 's/.* //')
test $pid = $nagiospid || rm -f $lockfile

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list