Re: [Nagios-devel] trying to find problem in cgi/status.c

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] trying to find problem in cgi/status.c

Post by Guest »

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/ ... .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
>
>
>
>
> Current Network Status
> .
> .
> .
> .
> 17d 1h 35m 54s
>
> 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
>
>
> --------

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked