'/etc/init.d/nagios2 reload' causes nagios to exit (sends SIGTERM not SIGHUP)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nagios2 (Ubuntu) |
Fix Released
|
Low
|
Nicolas Valcarcel |
Bug Description
Binary package hint: nagios2
The init script for nagios kills nagios when the user requests the configuration to be reloaded. Nagios logs that it has received a SIGTERM rather than the expected SIGHUP.
This appears to be a bug in the nagios2 (2.11-1ubuntu1) packages interaction with the lsb-base package in Hardy. This bug is not present in Debian with the 2.11-1 version of the nagios package.
The nagios init script calls killproc from the lsb-base scripts, passing it "1" (HUP) as the signal to send to nagios, the lsb-base scripts convert this to a TERM instead of a HUP.
I do not know if this is a bug in the lsb-base scripts, or the scripts being called incorrectly by the nagios init script, so I have filed this bug on Nagios as I suspect it is the more likely candidate to be at fault, it will be amazing if such a large bug in lsb-release managed to slip through the QA for an LTS release!
To reproduce the bug on a Hardy system you can do the following:
1) Install nagios2
2) Start nagios, check that it is running, tail /var/log/
3) In another console run, /etc/init.d/nagios2 reload
4) Observe the following lines in the log file
[1212255142] Nagios 2.11 starting... (PID=24439)
[1212255142] LOG VERSION: 2.0
[1212255142] Finished daemonizing... (New PID=24440)
< reload command is executed at this point>
[1212256400] Caught SIGTERM, shutting down...
[1212256401] Successfully shutdown... (PID=24440)
I have attached a patch that works around this issue by modifying the init script to send a HUP directly rather than using the killproc method from the lsb-base scripts. When this patch is applied the correct behaviour is observed in the nagios log file after executing /etc/init.d/nagios2 reload
[1212256426] Nagios 2.11 starting... (PID=27947)
[1212256426] LOG VERSION: 2.0
[1212256427] Finished daemonizing... (New PID=27948)
< reload command is executed at this point>
[1212257232] Caught SIGHUP, restarting...
[1212257232] Nagios 2.11 starting... (PID=27948)
[1212257232] LOG VERSION: 2.0
I can reproduce the bug, the reload command causes nagios to shotdown, not even restart.