Possible Bugs in Nagios configfile parsing

Sascha Runschke srunschke at abit.de
Wed Oct 20 14:35:23 CEST 2004


Greetings,

I just recently started migrating to SMS notifications and therefor 
testing escalations.
I discovered several possible bugs in the configfiles parsing.

I am using a CVS snapshot of nagios 2.0 dated from 08.10.2004.
config.c hasn't been modified since then according to the CVS.

Under certain circumstances nagios ends up in an endless loop in 
pre_flight_check().

Everything is running fine, unless I put any kind of escalation into the 
config files.

example:

define hostescalation {
host_name                  PDC01
first_notification          1
last_notification         1
notification_interval  60
contact_groups         SMS-Alarm
}

Now running nagios -v nagios.cfg:

[root at SRV00032 etc]# ../bin/nagioscheck

Nagios 2.0a1
Copyright (c) 1999-2004 Ethan Galstad (nagios at nagios.org)
Last Modified: 11-18-2003
License: GPL

Reading configuration data...

Running pre-flight check on configuration data...

Checking services...
        Checked 253 services.
Checking hosts...
Warning: Host 'ABIT-DMZ_switch' has no services associated with it!
Warning: Host 'RECHT.NET-DMZ_switch' has no services associated with it!
        Checked 106 hosts.
Checking host groups...
        Checked 35 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 9 contacts.
Checking contact groups...
        Checked 7 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking service dependencies...
        Checked 0 service dependencies.
Checking host escalations...

Then nagios hangs with 99.9% cpu load.

There is another interesting anomaly when I tried using escalations.

I had a contactgroup that was unused called SMS-Test. When that 
contactgroup
was activated nagios -v nagios.cfg outputs:

[root at SRV00032 etc]# ../bin/nagioscheck

Nagios 2.0a1
Copyright (c) 1999-2004 Ethan Galstad (nagios at nagios.org)
Last Modified: 11-18-2003
License: GPL

Reading configuration data...

Running pre-flight check on configuration data...

Checking services...
        Checked 253 services.
Checking hosts...
Warning: Host 'ABIT-DMZ_switch' has no services associated with it!
Warning: Host 'RECHT.NET-DMZ_switch' has no services associated with it!
        Checked 106 hosts.
Checking host groups...
        Checked 35 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 9 contacts.
Checking contact groups...

And nagios hangs again with 99.9% cpu load.
It didn't even get to checking the host escalations, for some reason it 
already
hangs in the contactgroups.cfg.

This leads me to the conclusion that checking the references relating to 
contacts does
have an error and can lead to a possible endless loop in 
pre_flight_check(). I took a
quick look into config.c, but the problem didn't strike me yet.
The code is quite... strange ;-)

The problem is that I don't believe it doesn't work for anyone, because I 
never seen
anyone mention it. Therefor some kind of circumstance I have must be 
provoking this
problem.

I'll try to put some more debugging output into config.c so I can see 
where exactly it hangs,
I'm not in the mood for exhaustive gdb sessions...

Since I am using cfg_dir directives in nagios.cfg for single cfg-files for 
each host, it's kinda
complicated to post those to the list. Especially because publishing those 
to the public
exposes all critical information for those systems acoording to internal 
IPs, services and
purposes. And I don't feel like editing hundreds of files...

Thanks for reading that far ;)

sash

--------------------------------------------------
Sascha Runschke
Netzwerk Administration
IT-Services

ABIT AG
Robert-Bosch-Str. 1
40668 Meerbusch

Tel.:+49 (0) 2150.9153.226
mailto:SRunschke at abit.de

http://www.abit.net
http://www.abit-epos.net
http://www.my-academy.net
--------------------------------------------------
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

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20041020/c8a89832/attachment.html>


More information about the Developers mailing list