How to configure nagios to work with apache source install(/usr/local/apache)

Ref:http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html

Basic nagios setup  works well if you install apache server by yum. But if you install and configure Apache from source to run different directory(i.e /usr/local/apache)  other then /etc/httpd/conf then then the default nagios web interface would not work because , by default nagios creates nagios.conf file in /etc/httpd/conf.d directory for fedora.

So if you have already installed apache from source then do the following:

Follow step 1 to 5 as documented in nagios website (Except  htpasswd section)

(a)

I assume , you have configured your Apache to run from /usr/local/apache , and your apache configuration file is in /usr/local/apache/conf/

copy nagios.conf file from /etc/httpd/conf.d to /usr/local/apache/conf/extra

cp /etc/httpd/conf.d/nagios.conf /usr/local/apache/conf/extra/

Edit  httpd.conf which located in  /usr/local/apache/conf/httpd.conf and add  the bellow line

Include conf/extra/nagios.conf

(b)

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

stop the apache server by /usr/local/apache/bin/apachectl stop

start the Apache server by /usr/local/apache/bin/apachectl start

Then Follow rest of the steps .

Extra note:

if you did install apache by yum , then you might see error like bellow :

[root@web nagios-3.2.0]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
/usr/bin/install: cannot create regular file `/etc/httpd/conf.d/nagios.conf’: No such file or directory
make: *** [install-webconf] Error 1

Solution : mkdir /etc/httpd/conf.d , now run

make install-webconf

So it will install nagios.conf file in /etc/httpd/conf.d directory. Now follow form (a) to (b)

Note : I am assuming you have configured apache to install on /usr/local/apache directory

Tags: , ,

Leave a Reply