trying to find problem in cgi/status.c

Ethan Galstad nagios at nagios.org
Fri Mar 11 01:47:47 CET 2005


Thanks for the note - patches will be in CVS shortly.


On 4 Mar 2005 at 18:17, John Warburton wrote:

> OK
> 
> Since no-one has responded (does anyone else live here?), I will
> report back as to what I had found...
> 
> One of our other admins set up a host definition without a 
> check_command. This is fine, as the documentation says "If you leave
> this argument blank, the host will not be checked - Nagios will always
> assume the host is up." (see
> http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#host)
> 
> Unfortunately, the code, when displaying host specific stuff (eg the
> "Host Detail" button, or 2-D status map), will assume that there is a
> value in the data structure for "plugin_output".
> 
> This explains my seg fault.
> 
> I can verify this by looking in /usr/local/nagios/var/retention.dat
> and the "plugin_output" entries for these hosts is empty.
> 
> To "fix", I stopped Nagios, edited the retention.dat file and put some
> text into the plugin_output field and restarted Nagios. The Host
> Details and 2D Status Map all came back!
> 
> These hosts now all have a check in place as well.
> 
> So, is there any chance for a change in the code to set plugin_output
> to a default null value (eg N/A) - whether host checks are made or
> not? Or, for the host printout code being more able to cope with
> variables not set.
> 
> Regards
> 
> John
> 
> On 3/03/2005 8:37 PM, John Warburton wrote:
> 
> > Hi All
> > 
> > I am running Nagios 2 beta - CVS snapshot Feb 24 19:47 2005 on
> > Solaris 8.
> > 
> > I have a problem where my host detail and status map options in the
> > left frame will die with a segmentation fault after displaying some
> > of my hosts. The number of hosts depends on the sort options.
> > 
> > Note that the "service detail" option will display *all* hosts and
> > *all* services. Weird.
> > 
> > I am guessing I am hitting some sort of problem, where the code
> > expects to see something in memory, but it is not there. I think it
> > may be in my hosts definition, but I have 25 hosts defined so not
> > sure if I have a typo in any of the definitions.
> > 
> > Each entry basically looks like:
> > define host{
> >         host_name                       nemesis
> >         alias                           db server
> >         address                         1.2.3.4
> >         check_command                   check-host-alive
> >         max_check_attempts              5
> >         contact_groups                  nagios-admins
> >         notification_interval           30
> >         notification_period             24x7
> >         notification_options            d,u,r
> >         }
> > 
> > Some hosts (not all) have partially filled out hostextinfo entries:
> > define hostextinfo{
> >         host_name                       thunderbird
> >         notes                           IMAP/POP3 Server
> >         notes_url                       URL
> >         action_url                      URL
> >         icon_image                      sun/ppserve450-68sm.jpg
> >         icon_image_alt                  Sun E450 Server
> >         }
> > 
> > I can run the status CGI from the command line:
> > export REMOTE_USER=userid
> > export REQUEST_METHOD=GET
> > export 
> > QUERY_STRING='hostgroup=all&style=hostdetail&sorttype=2&sortoption=4
> > '
> > 
> > $ pwd
> > /usr/local/nagios/src/nagios-cvs/cgi
> > 
> > $ /usr/local/bin/gdb  ./status.cgi
> > (gdb) run
> > Starting program: /usr/local/nagios/src/nagios-cvs/cgi/status.cgi
> > Cache-Control: no-store Pragma: no-cache Refresh: 90 Last-Modified:
> > Thu, 03 Mar 2005 09:31:51 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT
> > Content-type: text/html
> > 
> > <html>
> > <head>
> > <title>
> > Current Network Status
> > .
> > .
> > .
> > .
> > <TD CLASS='statusEven' nowrap>17d  1h 35m 54s</TD>
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > 0xff2b3218 in strlen () from /lib/libc.so.1
> > 
> > (gdb) where
> > #0  0xff2b3218 in strlen () from /lib/libc.so.1
> > #1  0xff306530 in _doprnt () from /lib/libc.so.1
> > #2  0xff3081d0 in printf () from /lib/libc.so.1
> > #3  0x0001a35c in show_host_detail () at status.c:2089
> > 
> > I am now at my limit in C and gdb, so was wondering if anyone had
> > any pointers as to how I debug the code to find out what the problem
> > is? ie how can I see the contents of the memory, and what the
> > variables are set at?
> > 
> > Thanks
> > 
> > John
> > 
> > 
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real
> > users. Discover which products truly live up to the hype. Start
> > reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > _______________________________________________ Nagios-devel mailing
> > list Nagios-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagios-devel
> > 
> 
> -- 
> John Warburton
> 9385 8046
> UNSW IT Services
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
> users. Discover which products truly live up to the hype. Start
> reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________ Nagios-devel mailing
> list Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
> 
> 



Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click




More information about the Developers mailing list