Tuesday, March 9, 2010

In pursuit of a monitoring solution for CentOS Linux: Part III - Nagios Server Installation

Continuation of "In pursuit of a monitoring solution for CentOS Linux"
Part I
Part II


Part III and IV covers installation of the Nagios Server and configuration of the Clients.

Nagios Server Install on CentOS 5.x

For the purpose of this install, Server will refer to the monitoring server and Client will refer to the servers being monitored.

0. Log in to Server as root

1. Install the necessary pacakges

yum install httpd gcc glibc glibc-common gd gd-devel php

2. Create user and group for Nagios
useradd -m nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache


3. Create directory to store Nagios Downloaded files

mkdir /opt/Nagios && cd /opt/Nagios
**Go to http://www.nagios.org/download/download.php and get the URL for the latest versions of the software. Use wget to download to directory.

4. Extract files
cd /opt/Nagios
tar xzf nagios-3.0.6.tar.gz
cd nagios-3.0.6


5. Compile and Configure
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf


6. Create Web Interface Login User
Create user “nagiosadmin” ( remember the password assigned !)
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

7. Restart Apache
service httpd restart


Install the Nagios Plugins

8. Extract files
cd /opt/Nagios
tar xzf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins1.4.13


9. Compile and Configure Nagios Plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install


10. Configure the email address to send notifications to
nano /usr/local/nagios/etc/objects/contacts.cfg
email nagios@localhost ; << CHANGE THIS TO YOUR EMAIL ADDRESS

11. Verify config file
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Expected output
Total Warnings: 0
Total Errors: 0

12. Start Nagios and set to start automatically on reboot.
chkconfig --add nagios
chkconfig nagios on
chkconfig httpd on
service nagios start


13. Log on to server from an internet browser
http://server.ip.address/nagios/

On to Part IV - Nagios Client install/configuration

-n