Page 1 of 3
Internal Server Error When Attempting to Schedule Downtime
Posted: Fri May 01, 2015 3:07 pm
by bfortman
I am fairly new to Nagios and have recently installed 4.08 running under Red Hat 6.6.
Overall, things are working well. However, when I attempt to schedule downtown on a server, or Post a Notification (or a few other tasks), I get the following error from Apache:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
And the Apache error_log shows:
Premature end of script headers: cmd.cgi, referer:
http://myserver/nagios/cgi-bin/extinfo. ... ost=myhost
I have tried several of the tricks posted to this forum from folks with similar issues. None have worked so far.
For Example:
[root@myserver httpd]# sestatus
SELinux status: disabled
Any additional information or other things to try would be greatly appreciated.
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 10:11 am
by tgriep
Could you run the following and post the output here?
Code: Select all
ll /usr/local/nagios/var/rw/
ll /usr/local/nagios/sbin
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 1:18 pm
by bfortman
# ll /usr/local/nagios/var/rw/
total 0
prw-rw---- 1 nagios nagcmd 0 May 4 13:15 nagios.cmd
srw-rw---- 1 nagios nagcmd 0 May 4 13:15 nagios.qh
# ll /usr/local/nagios/sbin
total 4920
-rwxrwxr-x. 1 nagios nagios 367240 Apr 13 13:56 archivejson.cgi
-rwxrwxr-x. 1 nagios nagios 352816 Apr 13 13:56 avail.cgi
-rwxrwxr-x 1 nagios nagios 356808 Apr 13 13:56 cmd.cgi
-rwxrwxr-x. 1 nagios nagios 351496 Apr 13 13:56 config.cgi
-rwxrwxr-x. 1 nagios nagios 353344 Apr 13 13:56 extinfo.cgi
-rwxrwxr-x. 1 nagios nagios 284512 Apr 13 13:56 history.cgi
-rwxrwxr-x. 1 nagios nagios 284272 Apr 13 13:56 notifications.cgi
-rwxrwxr-x. 1 nagios nagios 357120 Apr 13 13:56 objectjson.cgi
-rwxrwxr-x. 1 nagios nagios 283664 Apr 13 13:56 outages.cgi
-rwxrwxr-x. 1 nagios nagios 284384 Apr 13 13:56 showlog.cgi
-rwxrwxr-x. 1 nagios nagios 353064 Apr 13 13:56 status.cgi
-rwxrwxr-x. 1 nagios nagios 351184 Apr 13 13:56 statusjson.cgi
-rwxrwxr-x. 1 nagios nagios 288040 Apr 13 13:56 statuswml.cgi
-rwxrwxr-x. 1 nagios nagios 284144 Apr 13 13:56 statuswrl.cgi
-rwxrwxr-x. 1 nagios nagios 298288 Apr 13 13:56 summary.cgi
-rwxrwxr-x. 1 nagios nagios 284552 Apr 13 13:56 tac.cgi
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 1:26 pm
by tgriep
Could you run these too? I want to check to see if the nagcmd group is setup.
Code: Select all
grep nag /etc/passwd
grep nag /etc/group
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 1:53 pm
by bfortman
# grep nag /etc/passwd
nagios

505:506::/home/nagios:/bin/bash
nagiosadmin

506:508::/home/nagiosadmin:/bin/bash
# grep nag /etc/group
nagios

506:apache,nagiosadmin
nagcmd

507:nagios,nagiosadmin,apache
nagiosadmin

508:
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 2:15 pm
by jdalrymple
This all looks pretty workable. Is there anything in the general vicinity of your error_log as you mentioned - or just that 1 line?
bfortman wrote:And the Apache error_log shows:
Code: Select all
Premature end of script headers: cmd.cgi, referer: http://myserver/nagios/cgi-bin/extinfo.cgi?type=1&host=myhost
Did you compile from source? If so there may be some stuff in your logs that's useful there? Maybe something broke silently during compile time?
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 3:14 pm
by bfortman
The Apache access_log throws this single line:
nagiosadmin [04/May/2015:14:57:58 -0500] "GET /nagios/cgi-bin/cmd.cgi?cmd_typ=159&host=myhost HTTP/1.1" 500 608 "http://myserver/nagios/cgi-bin/extinfo. ... ost=myhost" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
Even in debug mode logging, the apache error_log only throws the one line "Premature end of script..."
I did compile Nagios Core from source. I have attached the output from "make all". There are a few warnings, but nothing appears to have broken during the compile.
I've narrowed down the Internal Server Errors to these specific activities:
Hosts - Send custom host notification
Hosts - Schedule downtime for this host
Hosts - Schedule downtime for all the services on this host
Downtime - Scheduled host downtime
Downtime - Schedulled service downtime
All other functionality works ok (with the exception of Map, Trends, and Histogram which I have not yet compiled separately)
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 4:35 pm
by ssax
I'm not seeing anything in your make log either.
Please post the output of these commands:
Code: Select all
ls -l /usr/local/nagios/var
ls -l /usr/local/nagios
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 4:40 pm
by jdalrymple
I assume based upon the error that this happens when you are trying to get to the schedule downtime page?
What are the results of
http://myserver/nagios/cgi-bin/extinfo.cgi
How about
http://myserver/nagios/cgi-bin/cmd.cgi
I expect both of those to work fine based upon what you've shared so far. Would you care to gzip up your cgis and send them my way? Unless you did any mad customization (which would no doubt be the source - no pun intended - of your problem) there should be no sensitive information. I'd love to just drop them on my 6.6 machine and see if they CGIs work properly here.
Re: Internal Server Error When Attempting to Schedule Downti
Posted: Mon May 04, 2015 4:47 pm
by tgriep
The account and settings do look like they work. Lets check a few more things. Run these commands.
Code: Select all
grep nagiosadmin /usr/local/nagios/etc/cgi.cfg
cat /etc/httpd/conf.d/nagios.conf