Nagios 3.3.1 segfaulting

Michael Hocke michael.hocke at nyu.edu
Fri Mar 2 22:20:41 CET 2012


-----BEGIN PGP SIGNED MESSAGE-----


Hello,

I did a complete new install of Nagios 3.3.1 on Solaris 10 (update 10) by compiling the source. Unfortunately, nagios segfaulted almost immediately after start-up right after logging these messages:

[1330706952] Nagios 3.3.1 starting... (PID=27830)
[1330706952] Local time is Fri Mar 02 11:49:12 EST 2012
[1330706952] LOG VERSION: 2.0
[1330706952] ndomod: NDOMOD 1.5 (02-03-2012) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1330706952] ndomod: Successfully connected to data sink.  0 queued items to flush.
[1330706952] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1330706952] Finished daemonizing... (New PID=27833)
[1330706952] INITIAL HOST STATE: sysmon1;UP;HARD;1;

In order to nail down what's happening I ran it under gdb control and found the culprit: it's the asprintf call within log_service_states in base/logging.c

asprintf(&temp_buffer,"%s SERVICE STATE: %s;%s;$SERVICESTATE$;$SERVICESTATETYPE$;$SERVICEATTEMPT$;%s\n",(type==INITIAL_STATES)?"INITIAL":"CURRENT",temp_service->host_name,temp_service->description,temp_service->plugin_output);

because the last parameter 'temp_service->plugin_output' is NULL. I looked through the rest of the code and I realized that the struct member 'plugin_output' is usually used as '(xxx -> plugin_output == NULL) ? "" : xxx -> plugin_output'. I changed it to make it look like just that, recompiled, and I didn't get any segmentation faults anymore. I was a bit perplexed, though, because I went back and checked a previous release of Nagios 3 (3.2.1 and 3.2.3) and I didn't see any differences. I checked the mailing lists but it seems that I am the only one who ran into this problem. Then I checked my configuration files again and browsed the source a bit more and realized that the code in question comes across this buf only if the 'type' is INITIAL_STATES and my configuration has 'log_initial_sta
 tes' set to '1'. And indeed Centreon (my front-end of choice) does set 'log_initial_states' to '1' which doesn't seem to be very common considering how long this bug has been in Nagios.

Anyway, is it okay to post a bug report here or are there other/better channels?

Thanks.

- - Michael


-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 10.0.3 (Build 1)
Charset: us-ascii

wsBVAwUBT1E5qpbfnpCg64TVAQEgBgf/Uxya/iYpDHKHYyCjjuFg7kdbcyP0rPz1
RSpjhhidRKc4a/G64WH7SE7g13EJfb7vMdK3kxouNdTuVJbHnv+Der07JfLyYYTA
5HjQBnG0CoNGg++4xaoWiTV4sxTeeOO0JhcnGI+fE66Iei60qOWPHIoCbiSzcjYv
hCIYO9fBfQlxuITCSLKNJsADvbksEqrrBUxobdF4ZZtZoSkGQfSw9yqUqpEip18c
h9LyCfWnpboqUrlGQ9CMDv/ptIgWabhTKw2BS9lvw9IkVQ2xdbuqX0S2CUI+Q1Lw
zdLqOaGxofiLALahTLd+nGQuzX2IdrmNz9xAxKTLOk+wQt/gTLdTlQ==
=d9+m
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list