Centos 6.4 Nagios RPM has CGI problems

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.
Locked
torenware
Posts: 2
Joined: Sat Feb 22, 2014 3:46 pm
Location: Santa Cruz, California

Centos 6.4 Nagios RPM has CGI problems

Post by torenware »

I've installed Nagios 3.5.1 on a 32-bit Centos 6.4 instance, just using the stock RPM from yum (nagios-3.5.1-1.el6.i686).

Apache sees Nagio, I authenticate fine as nagiosadmin, and I can get at the top level nagios page (in my case, http://192.168.33.10/nagios/), which displays fine.

The problem is that *all* of the subpages served by executables in /usr/lib/nagios/cgi-bi fail to work at all; apache treats them as binary downloads, and downloads them to disk. They are not executed, and the apache logs indicate that I'm getting successful downloads. Which is not what I need, obviously. There are no errors.

I can't see why the CGI are failing to execute as CGI. I'm using the unmodified /etc/httpd/conf.d/nagios.conf file as installed by the RPM, and apache has not been modified in any way. The *.cgi files are all executable. SELinux is disabled.

Just to make sure there's nothing stupid in the stock nagios.conf file, here's what's in it:

Code: Select all

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin/ "/usr/lib/nagios/cgi-bin/"

<Directory "/usr/lib/nagios/cgi-bin/">
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios/passwd
   Require valid-user
</Directory>

Alias /nagios "/usr/share/nagios/html"

<Directory "/usr/share/nagios/html">
#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios/passwd
   Require valid-user
</Directory>
I'm stumped as to what the problem is here. Obviously, the .conf file is getting read (since the /nagios link resolves), and the executables are exactly as described in the .conf.

Anybody see this? I've used plenty of web apps that use CGIs. I've never seen one fail so badly right out of the box when installed via an RPM.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Centos 6.4 Nagios RPM has CGI problems

Post by abrist »

Is php installed and is mod php and mod cgi running with apache?

Code: Select all

php -v
apachectl -t -D DUMP_MODULES | grep "php\|cgi"
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
torenware
Posts: 2
Joined: Sat Feb 22, 2014 3:46 pm
Location: Santa Cruz, California

Re: Centos 6.4 Nagios RPM has CGI problems

Post by torenware »

The issue turned out to be with mod_cgi.

I do more work in Ubuntu Server, and on CentOS 6, httpd now kinda sorta supports a2enmod. But only if the module has a .conf file in /etc/httpd/mods-available.

On CentOS 6.4, there is no cgi.conf file. So I assumed that it was compiled in, and not loadable.

This turned out to be wrong. But since you can't use a2enmod to activate mod_cgi, you need to add

Code: Select all

LoadModule cgi_module modules/mod_cgi.so
somewhere. I added it to the top of nagios.conf, which resolves the issue.

I've used Redhat distributions in the past, but CentOS 6.4 strikes me as a little weird.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Centos 6.4 Nagios RPM has CGI problems

Post by abrist »

torenware wrote:somewhere. I added it to the top of nagios.conf, which resolves the issue.
This is usually set in httpd.conf, but can alternatively be set on the vhost itself (as you have done above).
torenware wrote:I've used Redhat distributions in the past, but CentOS 6.4 strikes me as a little weird.
If you think centos is weird, take a look at fedora! I am glad this looks resolved, any other related issues, or should we lock this thread up?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked