Installing Nagios core on RHEL / CENTOS 5.x – RHEL / CentOS 6.x Fedora 15/16/17/18/19/20

Configuration CPU Monitoring DAEMON Monitoring fedora How To How To's Installation Latest Linux Linux Cluster Linux firewalls LVM Mail Mail Server Management Monitering Monitoring mysql NAGIOS Network Monitoring Network Packet NTP Server Online Storage Postfix Process Monitoring redhat Security server SMTP Snort Squid Squid Cluster ssh SUSE Terminal Tips and Tricks troubleshooting Tutorials Ubuntu Unix Virtualization web Web Server

What is Nagios

An enterprise-class monitoring and alerting solution that provides organizations with extended insight of their IT infrastructure before problems affect critical business processes.

Requirements

We require following things for Installing Nagios:
These are Just Pre-requisites. We need them to other things work …

1. Apache and PhP (php is optional)
2. gcc, glib, glibc-common, gd and gd-devel

I am performing this whole task on RHEL 5 and nagios core.

Installation

( A ) Installing/checking Dependencies
As we know we get these repositories already installed, so let’s check whether they are installed or not!..

Its a major step so please don’t skip this

Invoke the terminal and write these command one by one:

1 To Check Apache/Http

rpm -qa | grep httpd

2. To Check the Gcc

rpm -qa | grep gcc
rpm -qa | grep glibc glibc-common
rpm -qa | grep gd gd-devel

If everythings come ok lets move ahead…if not install the package using

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

( B ) Create User And Groups

We need to create a user Nagios and put it to group Nadmin

useradd -m Nagios
passwd Nagios
"Set the password for the user Nagios"

groupadd Nadmin

/usr/sbin/usermod -a -G Nadmin Nagios

/usr/sbin/usermod -a -G Nadmin apache

Building And Installing Nagios

Everything set lets begin with installation

1 Download Nagios tar using:

=> wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz

2 Untar it anywhere 

=> tar zxf nagios-3.2.0.tar.gz

3 Get into the directory

=> cd nagios-3.2.0

4 configure the nagios using this command

=> ./configure --with-command-group=Nadmin

5 Run Make commands to build up the files to install Nagios

=> make all

6 Then use make install to install the init scripts in directory /etc/rc.d/init.d

=> make install

7 Lets configure permission for holding external files 

=> make install-init

8 Install sample config files which can be found later in /usr/local/Nagios/etc

=> make install-config

9 This for commandmode installation

=> make install-commandmode

10 Set your Email Id using:

=> vi /usr/local/Nagios/etc/objects/contacts.cfg

Installing Web Interface
After Nagios is Installed lets install the Web interface a key Utility

1 Install web interface

=> make install-webconf

2 Create web interface account. Using this we gonna login for management 

=> htpasswd -c /usr/local/Nagios/etc/htpasswd.users nagiosadmin

3 Done lets start Apache

=> /sbin/service httpd restart

As we are done with installing both Nagios and web interface we are yet not completed everything…

What we need now Nagios plugin , so lets begin with that :)

Installing and Configuring Nagios plugins

Download plugins by typing this command in the terminal

=> wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz

Untar the file

=> tar zxf nagios-plugins-1.4.14.tar.gz

Change directory:

=> cd nagios-plugins-1.4.14

Lets configure it :)

=> ./configure --with-nagios-user=Nagios --with-nagios-group=Nadmin

Again make the files for the installation process

=> make

Install the plugins

=> make install

This is the second part of the Nagios installation Process

Now, we need to start the nagios

Here is the process for the same :

To make the nagios utility to work automatically use this:

=> /sbin/chkconfig --add nagios

Turn the Nagios on :)

=> /sbin/chkconfig nagios on

We need a check config file that can work for for auto start of nagios. To do that use 

=> /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

done??
Now start the service

/sbin/service nagios start

So here we are done with the nagios installation and configuration ….

For the web interface :
type the following in the URL

http://localhost/nagios orr http://ip/nagios

I tried to write this tutorial as simple as a 2nd standard guy can configure it 🙂  just a joke

any questions ??? let me know…..