Internal server error when running commands (cmd.cgi)

steveneu at visi.com steveneu at visi.com
Mon Sep 30 21:20:39 CEST 2002


 I created a php script to post or get to itself with variables. php can read 
params passed to it via GET or POST just fine. 
 I cut and pasted some forms from nagios to disable/enable a test for a 
service. I also created a GET URL with the same parameters as contained in the 
form. The GET links work just fine, the forms which are doing the POST give me 
an "internal server error" with a "premature end of script headers" entry in 
the http-error log.
 Is there a specific apache module that could be flaking out? Did something 
change in the cgis recently? This all started when I "upgraded" to beta 6. 

Quoting Nicholas Paufler <npaufler at incentre.net>:

> Just FYI, when I was experiencing troubles getting Nagios running I found
> the exact same behavior. I was trying to debug the CGI and while the
> documentation implied to me I should be using HTTP POST (hence, i set the
> variables as such) to test, it was segfaulting. Using HTTP get, however,
> worked just fine.
> 
> I did manage to get things working via some combination of restarting
> apache
> and Nagios, though, so I'm not sure if there was ever really a problem. I'd
> venture that the segfault on POST from the commandline is "normal", if not
> what is expected. So that's probably a bit of a red herring for you.
> 
> Have you tried any other CGI's to see whether GET or POST is working with
> them? If you have mod_php installed it should be trivial to write up a
> quick
> script to see if variables are being passed correctly on POST so hopefully
> you can eliminate either your httpd or nagios as the culprit.
> 
> Nicholas Paufler
> Systems Administrator
> The Internet Centre
> 
> ----- Original Message -----
> From: "Steve Neuharth" <steveneu at tiny.net>
> To: <nagios-users at lists.sourceforge.net>
> Cc: "Blaz Zupan" <blaz at si.FreeBSD.org>
> Sent: Sunday, September 29, 2002 8:14 AM
> Subject: Re: [Nagios-users] Internal server error when running commands
> (cmd.cgi)
> 
> 
> > It appears that the cgi's segfault when I POST to them. I can run them
> > from a shell everything works fine as long as I GET or HEAD but when I
> > POST, it dies. Likewise through the browser. If I use any form in nagios
> > to POST to any nagios CGI, I get the error. If I send the same params
> > via a GET:
> >
> "https://127.0.0.1/nagios/cgi-bin/cmd.cgi?cmd_typ=55&cmd_mod=2&host=ns.visi.
> com&com_author=Steve%20Neuharth&start_time=09/27/2002%2021:41:53&end_time=09
> /27/2002%2023:41:53&hours=2&minutes=0&fixed=1"
> > , the scripts run fine, no segfault.
> >
> > mmcclure at pneservices.com wrote:
> > > Apache's not giving you enough information to really determine what the
> > > problem is.
> > >
> > > Try running /usr/local/share/nagios/cgi-bin//cmd.cgi directly from a
> > > shell.  You'll have to set some environment variables, but you should
> be
> > > able to figure those out from the HTML source and other parts of your
> > > configuration.
> > >
> > > If you still can't figure it out after you have all the enviroment
> > > variables set up, post the error message, someone will probably know
> > > what it means.
> > >
> > > ----------
> > > Mike McClure, CCIE # 5125, CISSP # 30232
> > > PNE Services, Inc.  http://www.pneservices.com
> > > mmcclure at pneservices.com
> > > mobile: 913-636-5590
> > >
> > >
> > >>-----Original Message-----
> > >>From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> > >>admin at lists.sourceforge.net] On Behalf Of Steve Neuharth
> > >>Sent: Thursday, September 26, 2002 6:58 PM
> > >>To: Steve Neuharth
> > >>Cc: nagios-users at lists.sourceforge.net
> > >>Subject: Re: [Nagios-users] Internal server error when running
> > >
> > > commands
> > >
> > >>(cmd.cgi)
> > >>
> > >>So... anybody got any suggestions?
> > >>
> > >>Steve Neuharth wrote:
> > >>
> > >>>    I have nagios up and running (beats the pants off of BigBrother
> > >>
> > >>IMHO).
> > >>
> > >>>    I'm running FreeBSD 4.7 and I installed nagios straight from the
> > >>
> > >>ports
> > >>
> > >>>collection. I have done this several times before and the port
> > >>>maintainer does a great job of scripting the install so that it
> > >>
> > > works
> > >
> > >>>"out-of-the-box" as it were.
> > >>>    All of the cgi's seem to work BUT I get an internal server error
> > >>
> > >>when I
> > >>
> > >>>try to make cmd.cgi "do stuff" such as adding a comment, scheduling
> > >>
> > > a
> > >
> > >>>check. My first thought was file perms on the rw directory but I
> > >>
> > > cannot
> > >
> > >>>find anything wrong after reading the netsaint faq (this info is
> > >>
> > > missing
> > >
> > >>>from the nagios faq btw).  Here is my var/nagios dir:
> > >>>
> > >>>tiny# pwd
> > >>>/usr/local/var/nagios
> > >>>tiny# ls -l
> > >>>total 24502
> > >>>drwxrwxr-x  2 nagios  nagios      2560 Sep 26 00:00 archives
> > >>>-rw-rw-r--  1 nagios  nagios         0 Sep 26 00:06 comment.log
> > >>>-rw-rw-r--  1 nagios  nagios         0 Sep 26 00:06 downtime.log
> > >>>-rw-rw-r--  1 nagios  nagios   1266212 Sep 26 00:24
> > >>
> > > host-perfdata.out
> > >
> > >>>-rw-r--r--  1 root    nagios         6 Sep 26 00:06 nagios.lock
> > >>>-rw-rw-r--  1 nagios  nagios      1991 Sep 26 00:11 nagios.log
> > >>>drwxrwxr-x  2 nagios  www          512 Sep 26 00:06 rw
> > >>>-rw-rw-r--  1 nagios  nagios  23766777 Sep 26 00:24
> > >>
> > > service-perfdata.out
> > >
> > >>>-rw-rw-r--  1 nagios  nagios      3456 Sep 26 00:24 status.log
> > >>>-rw-r--r--  1 nagios  nagios      2563 Sep 26 00:06 status.sav
> > >>>
> > >>>another strange thing is the nagios.cmd file:
> > >>>tiny# pwd
> > >>>/usr/local/var/nagios/rw
> > >>>tiny# ls -l
> > >>>total 0
> > >>>prw-rw----  1 nagios  www  0 Sep 26 00:06 nagios.cmd
> > >>>
> > >>>why is it a pipe? should it be? maybe, but I thought it was strange.
> > >>>
> > >>>When I "submit" something I get "Internal Server Error" and in the
> > >>>apache log I get:
> > >>>[Thu Sep 26 00:27:30 2002] [error] [client 192.168.0.1] Premature
> > >>
> > > end of
> > >
> > >>>script headers: /usr/local/share/nagios/cgi-bin//cmd.cgi
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>-------------------------------------------------------
> > >>>This sf.net email is sponsored by:ThinkGeek
> > >>>Welcome to geek heaven.
> > >>>http://thinkgeek.com/sf
> > >>>_______________________________________________
> > >>>Nagios-users mailing list
> > >>>Nagios-users at lists.sourceforge.net
> > >>>https://lists.sourceforge.net/lists/listinfo/nagios-users
> > >>>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>-------------------------------------------------------
> > >>This sf.net email is sponsored by:ThinkGeek
> > >>Welcome to geek heaven.
> > >>http://thinkgeek.com/sf
> > >>_______________________________________________
> > >>Nagios-users mailing list
> > >>Nagios-users at lists.sourceforge.net
> > >>https://lists.sourceforge.net/lists/listinfo/nagios-users
> > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > _______________________________________________
> > > Nagios-users mailing list
> > > Nagios-users at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/nagios-users
> > >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Nagios-users mailing list
> > Nagios-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagios-users
> >
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> 
> 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Users mailing list