Internal Server Error When Attempting to Schedule Downtime

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.
bfortman
Posts: 11
Joined: Fri May 01, 2015 11:04 am

Internal Server Error When Attempting to Schedule Downtime

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Internal Server Error When Attempting to Schedule Downti

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
bfortman
Posts: 11
Joined: Fri May 01, 2015 11:04 am

Re: Internal Server Error When Attempting to Schedule Downti

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Internal Server Error When Attempting to Schedule Downti

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
bfortman
Posts: 11
Joined: Fri May 01, 2015 11:04 am

Re: Internal Server Error When Attempting to Schedule Downti

Post by bfortman »

# grep nag /etc/passwd
nagios:x:505:506::/home/nagios:/bin/bash
nagiosadmin:x:506:508::/home/nagiosadmin:/bin/bash

# grep nag /etc/group
nagios:x:506:apache,nagiosadmin
nagcmd:x:507:nagios,nagiosadmin,apache
nagiosadmin:x:508:
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Internal Server Error When Attempting to Schedule Downti

Post 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?
bfortman
Posts: 11
Joined: Fri May 01, 2015 11:04 am

Re: Internal Server Error When Attempting to Schedule Downti

Post 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)
Attachments
make.out.txt
Output results of "make all"
(12.52 KiB) Downloaded 337 times
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Internal Server Error When Attempting to Schedule Downti

Post 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Internal Server Error When Attempting to Schedule Downti

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Internal Server Error When Attempting to Schedule Downti

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked