Question about format of the CGI files


#1

Hi

I’ve managed to setup Nagios, at least, the configuration files are all accepted and I can get into the webinterface. I can access the documentation from the webinterface.

The problem starts as soon as I click one of the links that calls a cgi script, I get an internal server error in my browser. In my weblog (apache2), I find the message: premature end of script headers: tac.cgi, referer: (the ip address of my machine). I tested cgi functionality on my apachebox, I also tripplechecked the entries in the httpd.conf related to nagios.

So just out of curiosity I opened one of the cgi files of nagios in a texteditor, it does not look like cgi script at all but is filled with a load of strange characters. Now I’m not a cgi guru but as far as I know, cgi script need to be plain ascii, right?

My second question would be, how did these cgi’s become mangled and is there an easy way to replace them?

Thanks
Henk


#2

Some additional info:

I’m now aware of the fact that cgi files can be binary or text so I guess those are ok. I checked with the ldd command if the required libraries are available and they all are. I recompiled nagios, checked all installation options again and I can’t find anything wrong with it.

So, if cgi is working on my apache server but nagios cgi files give a premature end of scriptheader, what could be the problem?


#3

the nagios cgi (as far as i remeber) are compiled C.

Any errors during the configure part?
could it be you missed some authorizations or file permissions?

Luca


#4

No problems during configure, just ran configure once more to be sure. Pulling my hair our (almost), I can reach the documentation but as soon as I click a cgi, I get the internal server error. In the log the only reference I find is premature end of script header, no permission problem like some issues I found on this forum while looking for a solution.

I turned authorisation for the cgi’s off (to see if that works, no it didn’t). Permissions look good but I’ve played around with them anyway(on the cgi’s) just to see if that would change anything.


#5

Well I decided to take off the beta version2 of nagios and installed the stable 1.2 version. Configuring went without problems as did make. After the installation, I ran fruity and configured everything (just a handfull of hosts to monitor). Finally Nagios started without any errors, the thing is, I still get the premature end of script headers as soon as I click a cgi.

Surely somebody here must have a clue whats going on :slight_smile:


#6

Another reply by myself…

Got it sorted, I did not have the cgi authentication setup correctly. Walked once more through the instructions and it seems to work now.

Damn this software looks really good once you got it running :slight_smile:


#7

nice to know it works. :slight_smile:

and if i remeber right Nagios 2.02 is still beta only because of some missing docs.

Luca


#8

Possibly but I am using fruity for configuring and with Nagios v2 I have to edit some config files manually afterwards to get Nagios running. Version 1 does not have that problem :slight_smile:


#9

I had a similiar problem as you, except that the only cgi that didn’t work was trends.cgi. But after reading this, it fixed mine. So just in case, here you go.
"UPGRADING UNIX USERS: READ THIS FIRST! Modern versions of gd install by default to /usr/local/lib and /usr/local/include. If you already have an older version of gd in /usr/lib and /usr/include, you may wish to use:
./configure --prefix=/usr
To ensure that your new installation overwrites the old. "

boutell.com/gd/manual2.0.33.html