Thursday, January 21, 2010

Nagios installation steps on RHEL 4

Tested on RHEL4 + Fedora 11 + CentOs 5.3 (in my environment)

Download latest stable release.

1)Nagios-3.2.0.tar.gz
2)Nagios-plugins-1.4.14.tar.gz

Before Installation check the Prerequisites.
like this
#rpm -qa | grep httpd

If the prerequisite not installed ..use the following steps to install.

#yum install httpd php

#yum install gcc glibc glibc-common

#yum install gd gd-devel

Once you installed then follow next steps.

*** Login as Root on the machine ***

Add Nagios user

#useradd -m nagios

#passwd nagios ( but not required)

Now add Group,Add both the nagios user and the apache user to this group.

#groupadd nagcmd

#usermod -a -G nagcmd nagios

#usermod -a -G nagcmd apache


**** Installation Begin *******

Suppose you downloaded both packages under tmp dir

#cd /tmp

Now Extract nagios package

#tar -xvzf nagios-3.2.0.tar.gz

Now enter nagios dir.

#cd nagios-3.2.0

Now Run this command to script...

#./configure --with-command-group=nagcmd

Compile the Nagios source code.

#make all


Install binaries, init script, sample config files and set permissions on the external command directory.

#make install

#make install-init

#make install-config

#make install-commandmode

Now add you email id in configuration

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

on line number 35 you found like this
email nagios@localhost ; <<**** * CHANGE THIS TO YOUR EMAIL ADDRESS ******

Add your mail id..on which you want the alerts.

Save the file & quit.

*****Now configure web interface*******

#make install-webconf

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

#service httpd restart


****Now Install Nagios Plugin****

#cd /tmp

#tar -xvzf nagios-plugins-1.4.14.tar.gz

#cd nagios-plugins-1.4.14

#./configure --with-nagios-user=nagios --with-nagios-group=nagios

------------Note:-- On Red Hat machines you find message like this------------
configure: See http://nagiosplugins.org/faq/compile/configure_appears_to_hang if this next part takes a long time
checking for redhat spopen problem...

To solve this run the following command.

#./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround

-------------------------------------------------------------------------------------

#make

#make install



Nagios start automatically when the reboot the system.

#chkconfig --add nagios

#chkconfig nagios on

Verify the Nagios configuration files.

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

if there are no errors, start Nagios.

#service nagios start

------------------------------------------------------------
Make sure Selinux disable

#[root@inf1sysadm1 ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=disabled


Reboot the system after this setting.

Now login on web interface.

http://your-machine-ip/nagios/


Its time to Play with Nagios configuration........ enjoy it ...

0 comments: