<br><font size=2 face="sans-serif">Greetings,</font>
<br>
<br><font size=2 face="sans-serif">I just recently started migrating to SMS notifications and therefor testing escalations.</font>
<br><font size=2 face="sans-serif">I discovered several possible bugs in the configfiles parsing.</font>
<br>
<br><font size=2 face="sans-serif">I am using a CVS snapshot of nagios 2.0 dated from 08.10.2004.</font>
<br><font size=2 face="sans-serif">config.c hasn't been modified since then according to the CVS.</font>
<br>
<br><font size=2 face="sans-serif">Under certain circumstances nagios ends up in an endless loop in pre_flight_check().</font>
<br>
<br><font size=2 face="sans-serif">Everything is running fine, unless I put any kind of escalation into the config files.</font>
<br>
<br><font size=2 face="sans-serif">example:</font>
<br>
<br><font size=2 face="sans-serif">define hostescalation {</font>
<br><font size=2 face="sans-serif">host_name                  PDC01</font>
<br><font size=2 face="sans-serif">first_notification          1</font>
<br><font size=2 face="sans-serif">last_notification         1</font>
<br><font size=2 face="sans-serif">notification_interval  60</font>
<br><font size=2 face="sans-serif">contact_groups         SMS-Alarm</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br><font size=2 face="sans-serif">Now running nagios -v nagios.cfg:</font>
<br>
<br><font size=2 face="sans-serif">[root@SRV00032 etc]# ../bin/nagioscheck</font>
<br>
<br><font size=2 face="sans-serif">Nagios 2.0a1</font>
<br><font size=2 face="sans-serif">Copyright (c) 1999-2004 Ethan Galstad (nagios@nagios.org)</font>
<br><font size=2 face="sans-serif">Last Modified: 11-18-2003</font>
<br><font size=2 face="sans-serif">License: GPL</font>
<br>
<br><font size=2 face="sans-serif">Reading configuration data...</font>
<br>
<br><font size=2 face="sans-serif">Running pre-flight check on configuration data...</font>
<br>
<br><font size=2 face="sans-serif">Checking services...</font>
<br><font size=2 face="sans-serif">        Checked 253 services.</font>
<br><font size=2 face="sans-serif">Checking hosts...</font>
<br><font size=2 face="sans-serif">Warning: Host 'ABIT-DMZ_switch' has no services associated with it!</font>
<br><font size=2 face="sans-serif">Warning: Host 'RECHT.NET-DMZ_switch' has no services associated with it!</font>
<br><font size=2 face="sans-serif">        Checked 106 hosts.</font>
<br><font size=2 face="sans-serif">Checking host groups...</font>
<br><font size=2 face="sans-serif">        Checked 35 host groups.</font>
<br><font size=2 face="sans-serif">Checking service groups...</font>
<br><font size=2 face="sans-serif">        Checked 0 service groups.</font>
<br><font size=2 face="sans-serif">Checking contacts...</font>
<br><font size=2 face="sans-serif">        Checked 9 contacts.</font>
<br><font size=2 face="sans-serif">Checking contact groups...</font>
<br><font size=2 face="sans-serif">        Checked 7 contact groups.</font>
<br><font size=2 face="sans-serif">Checking service escalations...</font>
<br><font size=2 face="sans-serif">        Checked 0 service escalations.</font>
<br><font size=2 face="sans-serif">Checking service dependencies...</font>
<br><font size=2 face="sans-serif">        Checked 0 service dependencies.</font>
<br><font size=2 face="sans-serif">Checking host escalations...</font>
<br>
<br><font size=2 face="sans-serif">Then nagios hangs with 99.9% cpu load.</font>
<br>
<br><font size=2 face="sans-serif">There is another interesting anomaly when I tried using escalations.</font>
<br>
<br><font size=2 face="sans-serif">I had a contactgroup that was unused called SMS-Test. When that contactgroup</font>
<br><font size=2 face="sans-serif">was activated nagios -v nagios.cfg outputs:</font>
<br>
<br><font size=2 face="sans-serif">[root@SRV00032 etc]# ../bin/nagioscheck</font>
<br>
<br><font size=2 face="sans-serif">Nagios 2.0a1</font>
<br><font size=2 face="sans-serif">Copyright (c) 1999-2004 Ethan Galstad (nagios@nagios.org)</font>
<br><font size=2 face="sans-serif">Last Modified: 11-18-2003</font>
<br><font size=2 face="sans-serif">License: GPL</font>
<br>
<br><font size=2 face="sans-serif">Reading configuration data...</font>
<br>
<br><font size=2 face="sans-serif">Running pre-flight check on configuration data...</font>
<br>
<br><font size=2 face="sans-serif">Checking services...</font>
<br><font size=2 face="sans-serif">        Checked 253 services.</font>
<br><font size=2 face="sans-serif">Checking hosts...</font>
<br><font size=2 face="sans-serif">Warning: Host 'ABIT-DMZ_switch' has no services associated with it!</font>
<br><font size=2 face="sans-serif">Warning: Host 'RECHT.NET-DMZ_switch' has no services associated with it!</font>
<br><font size=2 face="sans-serif">        Checked 106 hosts.</font>
<br><font size=2 face="sans-serif">Checking host groups...</font>
<br><font size=2 face="sans-serif">        Checked 35 host groups.</font>
<br><font size=2 face="sans-serif">Checking service groups...</font>
<br><font size=2 face="sans-serif">        Checked 0 service groups.</font>
<br><font size=2 face="sans-serif">Checking contacts...</font>
<br><font size=2 face="sans-serif">        Checked 9 contacts.</font>
<br><font size=2 face="sans-serif">Checking contact groups...</font>
<br>
<br><font size=2 face="sans-serif">And nagios hangs again with 99.9% cpu load.</font>
<br><font size=2 face="sans-serif">It didn't even get to checking the host escalations, for some reason it already</font>
<br><font size=2 face="sans-serif">hangs in the contactgroups.cfg.</font>
<br>
<br><font size=2 face="sans-serif">This leads me to the conclusion that checking the references relating to contacts does</font>
<br><font size=2 face="sans-serif">have an error and can lead to a possible endless loop in pre_flight_check(). I took a</font>
<br><font size=2 face="sans-serif">quick look into config.c, but the problem didn't strike me yet.</font>
<br><font size=2 face="sans-serif">The code is quite... strange ;-)</font>
<br>
<br><font size=2 face="sans-serif">The problem is that I don't believe it doesn't work for anyone, because I never seen</font>
<br><font size=2 face="sans-serif">anyone mention it. Therefor some kind of circumstance I have must be provoking this</font>
<br><font size=2 face="sans-serif">problem.</font>
<br>
<br><font size=2 face="sans-serif">I'll try to put some more debugging output into config.c so I can see where exactly it hangs,</font>
<br><font size=2 face="sans-serif">I'm not in the mood for exhaustive gdb sessions...</font>
<br>
<br><font size=2 face="sans-serif">Since I am using cfg_dir directives in nagios.cfg for single cfg-files for each host, it's kinda</font>
<br><font size=2 face="sans-serif">complicated to post those to the list. Especially because publishing those to the public</font>
<br><font size=2 face="sans-serif">exposes all critical information for those systems acoording to internal IPs, services and</font>
<br><font size=2 face="sans-serif">purposes. And I don't feel like editing hundreds of files...</font>
<br>
<br><font size=2 face="sans-serif">Thanks for reading that far ;)</font>
<br>
<br><font size=2 face="sans-serif">sash</font>
<br>
<br><font size=2 face="sans-serif">--------------------------------------------------<br>
Sascha Runschke<br>
Netzwerk Administration<br>
IT-Services<br>
<br>
ABIT AG<br>
Robert-Bosch-Str. 1<br>
40668 Meerbusch<br>
<br>
Tel.:+49 (0) 2150.9153.226<br>
mailto:SRunschke@abit.de<br>
<br>
http://www.abit.net<br>
http://www.abit-epos.net<br>
http://www.my-academy.net<br>
--------------------------------------------------<br>
Der Inhalt dieser Email sowie die Anhänge sind ausschließlich für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat dieser Email oder dessen Vertreter sein sollten, so beachten Sie bitte, daß jede Form der Kenntnisnahme, Veröffentlichung,  Vervielfältigung oder Weitergabe des Inhalts dieser Email unzulässig ist. Wir möchten Sie außerdem darauf hinweisen, daß die Kommunikation per Email über das Internet unsicher ist, da fuer unberechtigte Dritte grundsätzlich die Möglichkeit der Kenntnisnahme und Manipulation besteht. Wenn Sie diese Nachricht versehentlich erhalten, informieren Sie bitte den Absender und löschen diese Nachricht mit den Anhängen. Herzlichen Dank<br>
<br>
The information and any attachments contained in this email are intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any form of disclosure, reproduction, distribution or any action taken or refrained from in reliance on it, is prohibited and may be unlawful. We also like to inform you that communication via email over the internet is insecure because third parties may have the possibility to access and manipulate emails. If you have received the message in error, please advise the sender and delete the message and any attachments. Thank you very much.</font>