Nagios4 and apache 2.4

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.
janroc
Posts: 7
Joined: Fri Aug 01, 2014 3:34 am

Nagios4 and apache 2.4

Post by janroc »

Hi all,

My first topic on this forum.

I am running Nagios 4.0.7 on a FreeBSD 8.4 and apache.
After upgrade apache from 2.2 to 2.4 I have now problem to get the web interface fully up and running again.
Yes I know the apache have change the ACL, but there most be more for nagios4.
Any friendly person how can help with the httpd.conf for apache 2.4?
This what I have right now.

<Directory /usr/local/www/nagios/cgi-bin>
Options +ExecCGI
AllowOverride None
Require all granted
Allow from all
AuthName "Nagios Access"
Authtype Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
Options Indexes Includes FollowSymLinks
</Directory>

ScriptAlias /nagios/cgi-bin/ "/usr/local/www/nagios/cgi-bin/"
Alias /nagios /usr/local/www/nagios/

<Directory "ScriptAlias /nagios/cgi-bin">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>



//Jan
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios4 and apache 2.4

Post by eloyd »

What are the symptoms that you are seeing that make you think it isn't working?
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
janroc
Posts: 7
Joined: Fri Aug 01, 2014 3:34 am

Re: Nagios4 and apache 2.4

Post by janroc »

I get two frames.
The right one with The webpage cannot be found and This error (HTTP 404 Not Found) and the left just shoing path to diffrent CGI like below.

Current Status
/tac.cgi" target="">Tactical Overview
/statusmap.cgi?host=all" target="">Map
/status.cgi?hostgroup=all&style=hostdetail" target="">Hosts
/status.cgi?host=all" target="">Services
/status.cgi?hostgroup=all&style=overview" target="">Host Groups
/status.cgi?hostgroup=all&style=summary" target="">Summary
/status.cgi?hostgroup=all&style=grid" target="">Grid

Jan
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios4 and apache 2.4

Post by eloyd »

Can you post the appropriate parts of your Apache log files? /var/log/httpd/error_log and /var/log/http/access_log would be the standard locations.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
janroc
Posts: 7
Joined: Fri Aug 01, 2014 3:34 am

Re: Nagios4 and apache 2.4

Post by janroc »

This was the old 2.2 that was working:
<Directory /usr/local/www/nagios>

Options +Indexes FollowSymLinks +ExecCGI
AllowOverride Indexes AuthConfig FileInfo
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUSerFile /usr/local/etc/nagios/htpasswd.users
Require valid-user

</Directory>

<Directory /usr/local/www/nagios/cgi-bin>
Options +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
Authtype Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user

</Directory>


ScriptAlias /nagios/cgi-bin/ "/usr/local/www/nagios/cgi-bin/"
Alias /nagios /usr/local/www/nagios/

<Directory "ScriptAlias /nagios/cgi-bin">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>

This is one of many 2.4 that I have tried with.

<Directory /usr/local/www/nagios>
Require all denied
Allow from 127.0.0.1
DirectoryIndex index.php
AddType application/x-httpd-php .php.
AddType application/x-httpd-php-source .phps.
Options Indexes Includes FollowSymLinks
AuthName "Nagios Access"
AuthType Basic
AuthUSerFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
php_flag engine on
php_admin_value open_basedir /usr/local/www/nagios/:/var/spool/nagios/
</Directory>

<Directory /usr/local/www/nagios/cgi-bin>
Options +ExecCGI
</Directory>

ScriptAlias /nagios/cgi-bin/ "/usr/local/www/nagios/cgi-bin/"
Alias /nagios /usr/local/www/nagios/

Here is the log files:
httpd-access:

10.129.205.129 - nagiosadmin [04/Aug/2014:08:19:50 +0200] "GET /nagios/ HTTP/1.1" 200 1708
10.129.205.129 - nagiosadmin [04/Aug/2014:08:19:50 +0200] "GET /nagios/side.php HTTP/1.1" 200 6009
10.129.205.129 - nagiosadmin [04/Aug/2014:08:19:50 +0200] "GET /nagios/%3C?php%20echo%20$url;%20?> HTTP/1.1" 404 209
10.129.205.129 - nagiosadmin [04/Aug/2014:08:19:50 +0200] "GET /nagios/stylesheets/common.css?<?php%20echo%20$this_version;%20?> HTTP/1.1" 200 9734
10.129.205.129 - nagiosadmin [04/Aug/2014:08:19:50 +0200] "GET /nagios/images/sblogo.png HTTP/1.1" 200 3231
10.111.2.122 - - [04/Aug/2014:08:19:50 +0200] "GET /" 200 45
10.111.2.121 - - [04/Aug/2014:08:19:51 +0200] "GET /" 200 45
10.111.2.122 - - [04/Aug/2014:08:19:55 +0200] "GET /" 200 45

Nothing in the httpd-error when I try to access Nagios.
But if I restart apache I get this:
[Mon Aug 04 08:22:03.285341 2014] [mpm_prefork:notice] [pid 9211] AH00169: caught SIGTERM, shutting down
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/gd.so' - Shared object "libfreetype.so.9" not found, required by "gd.so" in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/snmp.so' - Shared object "libpkg.so.1" not found, required by "snmp.so" in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
[Mon Aug 04 08:22:03.429276 2014] [mpm_prefork:notice] [pid 63566] AH00163: Apache/2.4.10 (FreeBSD) PHP/5.4.30 configured -- resuming normal operations
[Mon Aug 04 08:22:03.429336 2014] [core:notice] [pid 63566] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'

//Jan
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios4 and apache 2.4

Post by eloyd »

I see this and I cringe:
GET /nagios/stylesheets/common.css?<?php%20echo%20$this_version;%20?>
It looks like something is not parsing PHP properly. Do you have PHP and mod_php installed on your system? Is it being loaded into Apache?
Last edited by eloyd on Tue Aug 05, 2014 7:27 am, edited 1 time in total.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
janroc
Posts: 7
Joined: Fri Aug 01, 2014 3:34 am

Re: Nagios4 and apache 2.4

Post by janroc »

Yes I have both.
I also have cacti installed on the same pc and Cati is using PHP without any problem.

The httpd-error.log is celan now after "apachectl restart" but still I have problem with Nagios4.

[Tue Aug 05 09:45:11.226302 2014] [mpm_prefork:notice] [pid 59294] AH00169: caught SIGTERM, shutting down
[Tue Aug 05 09:45:11.719286 2014] [mpm_prefork:notice] [pid 61447] AH00163: Apache/2.4.10 (FreeBSD) PHP/5.4.30 configured -- resuming normal operations
[Tue Aug 05 09:45:11.719346 2014] [core:notice] [pid 61447] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'


Jan
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Nagios4 and apache 2.4

Post by emislivec »

What did you do to fix the errors:

Code: Select all

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/gd.so' - Shared object "libfreetype.so.9" not found, required by "gd.so" in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/snmp.so' - Shared object "libpkg.so.1" not found, required by "snmp.so" in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
Are you having the same problems with Nagios as before?
janroc
Posts: 7
Joined: Fri Aug 01, 2014 3:34 am

Re: Nagios4 and apache 2.4

Post by janroc »

emislivec wrote:What did you do to fix the errors:

Code: Select all

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/gd.so' - Shared object "libfreetype.so.9" not found, required by "gd.so" in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525/snmp.so' - Shared object "libpkg.so.1" not found, required by "snmp.so" in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
Are you having the same problems with Nagios as before?
Reinstalled the PHP and the moudules.
Do anybody have a httpd.conf example that is working in apache 2.4 that I can try?

//Jan
Last edited by janroc on Fri Aug 08, 2014 1:03 am, edited 1 time in total.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios4 and apache 2.4

Post by abrist »

I don't think we have one internally, though at this point in apache's version cycle we really should. Anybody out there have a working apache 2.4 vhost config?
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