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
Init Script
Re: Init Script
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.
Re: Init Script
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
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
Re: Init Script
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.
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.
Re: Init Script
Ahh! your right its in the config file! will update the config file to match the init script
sorry about that
sorry about that
Re: Init Script
No problem, it's very easy to make these kinds of mistakes (and we all do). Glad I could help!