Nagios 1.2 and Fedora Core 4

Andreas Ericsson ae at op5.se
Sat Nov 5 16:25:36 CET 2005



David Benigni wrote:
> I'm stuck!  I've run Nagios on may linux OS's before and FC4 is really
> being a pain.  Nagios compiles and runs, but the cgi's are broken with
> the following Apache log:
> 
> Premature end of script headers: status.cgi, referer:
> http://x.x.x.x/nagios/side.html 
> 

This happens when the cgi's, for one reason or another, *start* 
executing but then crash before they have time to write the header part 
of the output (cgi-programs are expected to create their own http header).

This can happen for any number of reasons with the most common being (in 
top-down order):
1. Insufficient permissions to read the cgi.cfg file or some other vital 
file. On Nagios 1.x, this would also happen if it fails to read the 
nagios.cfg file.

2. Nagios is compiled manually from source and some library or other has 
been upgraded to a version that isn't backwards-compatible and that the 
cgi's depend on. This is by far the most likely source of the problem if 
it's isolated to any of the graph-drawing cgi's.

3. The webserver is an old one, compiled to treat all .cgi-files as 
perl-scripts and the particular mod_perl interpreter crashes when it 
tries to parse the binary cgi's (afaik, this happened alot with perl < 5.6).

4. Something never mentioned before on this list is going on.

> I've read the info about suexec, permissions and uid.  None of those
> have made forward progress with this problem.  
> 

Which is why you get a nice helpful response, so it wasn't totally 
wasted anyways. I'm dead serious about this.

> Does any one have any ideas?
> 

su - httpd
/usr/local/sbin/tac.cgi

Set the necessary environment variables and run the cgi in strace (man 
strace for details). If it SIGSEGV's, make sure to do
	ulimit -c unlimited

and run it again with the exact same arguments as you used when it 
segfaulted earlier. This should produce a core-dump which you can then 
use with gdb, like so;

	gdb /usr/local/sbin/tac.cgi core
	<lots of gdb output about libraries linked in>
	(gdb) bt
	<hopefully, lots and lots of useful information about what function the 
segmentation violation occurred in, along with the name of the variable 
being manipulated at the time of the SIGSEGV>

If you get a lot of hex and nothing humanly readable in the gdb output, 
re-compile the cgi's and install them without stripping them. You can 
determine if a binary is stripped by using the 'file' command. If 'file' 
output ends with "not stripped" that means there are debugging symbols 
left in the binary which will be used for symbol name resolution (i.e. 
turns computer-addresses to humanly readable function names).

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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