[omd-devel] init.d/icinga Signal 5 exit - send no feedback to user

Olivier Contant contant.olivier at gmail.com
Fri Dec 6 19:04:10 CET 2013


Hi,





I found it was confusing to troubleshoot an issue about why icinga.cfg
wasn’t parsed in tmp/ when I tried to start the service using omd start
mysite icinga.

-        The script return nothing and just finished and return to shell.

-        After doing a status : omd status mysite icinga, it returned only
unused ...

-        Going in init.d and running icinga checkconfig, the script return
nothing and return to shell, start and stop the same and status continue to
return unused.



I had to read the source code of init.d/icinga and load all the includes
file in my editor to trace and figure out what went wrong.

-        dig in the init.d script to figure out that the script only exit 5
if the omd is not configured to use icinga on the value of variable
$CONFIG_CORE defined in etc/omd/site.conf







It shouldn’t be to the user to dig in the init.d script to figure it out.
An explicit message should be thrown to explain what went wrong and how to
fix it.

My suggestion is to add a trap to the script to catch exit 5 and throw an
explicit message to the user before exiting properly.





Piece of code involved:

etc/init.d/icinga



37 : cd /omd/sites/mtl_omd01

38 : . .profile

39 : . lib/omd/init_profile

40 : . etc/omd/site.conf

41: [ "$CONFIG_CORE" = "icinga" ] || exit 5



Variable $CONFIG_CORE is declared in etc/omd/site.conf





Since there is only one reference for a Signal 5 exit in the script,
changing the if statement would be the easiest way.  If there is other
condition that use signal 5 exit, it would be better to use a trap signal
instead.



If [ "$CONFIG_CORE" = "icinga" ]; then

 echo “Value of variable $CONFIG_CORE in $OMD_ROOT/etc/omd/site.conf is set
to nagios.”

  echo “To use icinga engine instead, change the value to:
 CONFIG_CORE=’icinga’”

  exit 5

fi





Thank you for your consideration,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mathias-kettner.de/pipermail/omd-devel/attachments/20131206/4af3c4bc/attachment.html>


More information about the omd-devel mailing list