Mar 24, 2011

Nagios Installation in Linux

Nagios Installation in Linux

Release:
RedHat Enterprise Linux

Problem:
Install Nagios system monitoring tool in RedHat Enterprise Server.

Solution:
  1. Download the Nagios from the below link
         http://www.nagios.org/download
  1. Install the require RPMs

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

  1. Create a user account to install the nagios

# useradd nagios
# passwd nagios

  1. Create a new group and add both nagios and apache users in that group

# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache

  1. Compile and install the nagios

# tar zxvf nagios-xxx.tar.gz
# cd nagios-xxx
# ./configure –with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode

  1. Sample configuration files are available in the below directory

# cd /usr/local/nagios/etc

  1. Customize the below file to send alerts to the mail id

# vi /usr/local/nagios/etc/objects/contacts.cfg

  1. configure the web interface by using the below command

# make install-webconf

  1. Create a login account to login into nagios web interface.

# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin


Note: Here “nagiosadmin” is the user account to login in the web interface.


  1. Restart the httpd service

# service httpd restart

  1. Compile and install the nagios plugins

# tar -zxvf nagois-plugins-xxx.tar.gz
# cd nagios-plugins-xxx
# ./configure –with-nagios-user=nagio –with-nagios-group=nagios
# make
# make install

  1. Add the nagios service to the system service by using the below commands

# chkconfig –add nagios
# chkconfig nagios on

  1. Verify the nagios configuration file and start the service

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios start

  1. Access the nagios web interface by using the below URL.