Init Script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mykie
Posts: 8
Joined: Thu Sep 29, 2011 9:01 am

Init Script

Post by mykie »

Hey

has anyone else come across the problem with the init script?

I just built the package from the source code but with the init script it doesnt seem to be grabbing the pid for nagios when starting so is unable to stop the process when requested.

This has proven to be a problem with puppet as it restarts my nagios a fair but and I end up with several nagios process

Thanks
Mike
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Init Script

Post by agriffin »

Does Nagios have permission to read and write to the lock file? By default it should be located at /usr/local/nagios/var/nagios.lock.
mykie
Posts: 8
Joined: Thu Sep 29, 2011 9:01 am

Re: Init Script

Post by mykie »

yeah it not a problem with that file, its the /var/run/nagios.pid i'm having a problem with

the stop routine in the init script uses this file to extract the PID and then runs a kill against this ID.
However the start routine touch's this file but doesn't actually drop a pid in there.

So this will also be breaking the status routine as that trys get the pid from the same file


for now i've got around it by adding `pgrep -of nagios.cfg > $NagiosRunFile` into the start routine in the init script
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Init Script

Post by agriffin »

Okay, I saw your other thread right after replying here. Thanks for posting the fix. Looking at the init script I see the same thing, but as a fall back it should also just be doing a blanket `kill -9` on all processes matching "/usr/local/nagios/bin/nagios -d". So the script should still be working anyway. If you want we can pursue this further, otherwise I'll just file a bug report for you so hopefully you won't have this problem in the future.

EDIT: Actually, the nagios daemon should be writing its pid to this file itself. There is a config option in nagios.cfg to define which file to write to. You may want to make sure it matches the path in the init script.
mykie
Posts: 8
Joined: Thu Sep 29, 2011 9:01 am

Re: Init Script

Post by mykie »

Ahh! your right its in the config file! will update the config file to match the init script

sorry about that :roll:
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Init Script

Post by agriffin »

No problem, it's very easy to make these kinds of mistakes (and we all do). Glad I could help!
Locked