Jump to content


0
[Tutorial]

Installing Nagios on RHEL 5



16 replies to this topic

#1 konstantine

konstantine

    Linux Freak

  • Members
  • PipPipPip
  • 55 posts
  • 25 thanks
  • Location------------CLASSIFIED-----------

Posted 17 August 2010 - 01:23 PM

Hello CC's

Many of my CC friend asked me the procedure of installing nagios!!!

I tried for that so have a look........

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 plesase 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 heheh :D

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 :D, 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 , hehehhe :D

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 :D just a joke

any questions ??? let me know.....

regards,
Konstantine :D
RHCE - (RHEL 5),ITSEH ,CCNA
Knowledge shared = =  knowledge doubled

===================================================================

Thanked by 3 Members:
amrchicco , chall1600 , sarand

#2 Rrv

Rrv

    Member

  • Members
  • PipPip
  • 14 posts
  • 7 thanks

Posted 15 October 2010 - 09:31 PM

thz for all in cent os runs without problema xD

#3 Glavin

Glavin

    VERSION 1.0

  • Senior Super Moderators
  • 695 posts
  • 42231 thanks

Posted 21 October 2010 - 09:49 AM

Thanks for this wonderful tutorial.

Cheers:D
Before posting under Share sections, Make sure you've read the updated rules posted here http://certcollection.org/forum/forum-175/announcement-8-share-section-rules-read-before-posting/

Help us keep this forum clean by reporting spam / scam / non IT related posts and threads.

Follow us on http://twitter.com/certcollection

#4 ChennaiWarrior

ChennaiWarrior

    Hardware TE

  • Technical Expert
  • PipPipPip
  • 105 posts
  • 18 thanks
  • LocationChennai, India

Posted 26 October 2010 - 03:47 AM

Thanks for the valueable info
A+ Certified IT Technician, MCP, MCTS, RHCE(In Progress)

#5 govanceiznosa

govanceiznosa

    Member

  • Members
  • PipPip
  • 15 posts
  • 127 thanks

Posted 26 October 2010 - 06:49 AM

Thx great tutorial.

#6 ChennaiWarrior

ChennaiWarrior

    Hardware TE

  • Technical Expert
  • PipPipPip
  • 105 posts
  • 18 thanks
  • LocationChennai, India

Posted 06 December 2010 - 11:39 AM

Hi Mr.Konstantine,

    I have installed Cent OS 5.5 on a Virtual machine and tried to Install and Configure Nagios
as thought by you. I have done everything and there was no single error and everything went fine.
When I opened the web interface it shows as "Internal Server Error" I dont know whats wrong with that
Please check the below image for the exact error.

Posted Image

Regards,
Syed Abbas
A+ Certified IT Technician, MCP, MCTS, RHCE(In Progress)

#7 ChennaiWarrior

ChennaiWarrior

    Hardware TE

  • Technical Expert
  • PipPipPip
  • 105 posts
  • 18 thanks
  • LocationChennai, India

Posted 07 December 2010 - 05:52 AM

Hey I got the solution for this problem
Actually this was due to SElinux was in enforced mode. Hence have disabled now its working fine.

Regards,
Syed Abbas
A+ Certified IT Technician, MCP, MCTS, RHCE(In Progress)

#8 Qarar

Qarar

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts
  • 169 thanks

Posted 08 December 2010 - 11:07 PM

thanx

Edited by Qarar, 08 December 2010 - 11:08 PM.


#9 VirtualMatrix

VirtualMatrix

    VMware Moderator

  • Honorary members
  • PipPipPip
  • 211 posts
  • 12171 thanks
  • LocationNowhere in the world, Waiting for "Tamil Eelam"

Posted 15 December 2010 - 10:55 AM

Very nice.

#10 arvindsony

arvindsony

    Member

  • Members
  • PipPip
  • 23 posts
  • 17 thanks

Posted 01 May 2011 - 08:46 AM

:close:
good one ......

#11 umer_javed

umer_javed

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts
  • 29 thanks

Posted 09 May 2011 - 03:06 PM

Well explained or other wise anyone can use the following link recommended or explained by Nagios officially for Redhat, Fedora, CentOS for me it was piece of cake hope you all will fine it interesting and helping.

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

Regards,

Omer

Thanked by 1 Member:
rajesh9399

#12 rajesh9399

rajesh9399

    Junior Member

  • Members
  • PipPip
  • 1 posts
  • 0 thanks

Posted 03 August 2011 - 01:30 PM

How to add clients to Nagios server can any one provide document

#13 konstantine

konstantine

    Linux Freak

  • Members
  • PipPipPip
  • 55 posts
  • 25 thanks
  • Location------------CLASSIFIED-----------

Posted 25 August 2011 - 02:02 AM

View Postrajesh9399, on 03 August 2011 - 01:30 PM, said:

How to add clients to Nagios server can any one provide document


Hello...
can you be more specific.. what you mean by clients... do you mean hosts?????
RHCE - (RHEL 5),ITSEH ,CCNA
Knowledge shared = =  knowledge doubled

===================================================================

#14 konstantine

konstantine

    Linux Freak

  • Members
  • PipPipPip
  • 55 posts
  • 25 thanks
  • Location------------CLASSIFIED-----------

Posted 25 August 2011 - 02:12 AM

Hey Fellas,

Here is and add-on Tutorial On How-To add hosts to nagios server.


To start , In the remote host add nagios user :

/usr/sbin/useradd nagios passwd nagios
We need two packages .

Nagios-plugin and Nrpe (download the latst version from the nagios web site)

Compile and install the plugins. (1.4.13)

./configure
make
make install

The permissions on the plugin directory and the plugins will need to be fixed at this point, so run the following commands.

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
Install XINETD .

Quote

Fedora/centos/RHEL

yum Install xinetd

In other Linux distro please use : apt-get (UBUNTU/DEBIAN) or zypper (OPENSUSE) or your slackware download manager .

Install the NRPE daemon

Download the source code tarball of the NRPE addon (visit http://www.nagios.org/download/ for links to the latest

versions).
.

cd ~/downloads
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz

Extract the NRPE source code tarball.

tar xzf nrpe-2.12.tar.gz
cd nrpe-2.12

Compile the NRPE addon.

./configure
makeall

Install the NRPE plugin (for testing), daemon, and sample daemon config file.

make install-plugin
make install-daemon
make install-daemon-config

Install the NRPE daemon as a service under xinetd.

make install-xinetd

Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.

only_from = 127.0.0.1

Add the following entry for the NRPE daemon to the /etc/services file.

nrpe 5666/tcp # NRPE

Restart the xinetd service.

service xinetd restart

Test the NRPE daemon locally

Its time to see if things are working properly...

Make sure the nrpe daemon is running under xinetd.

netstat -at | grep nrpe

The output out this command should show something like this:

tcp 0 0 *:nrpe *:* LISTEN

if you are using the IPtables, add this line :

iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 5666 -j ACCEPT

Save the new iptables rule so it will survive machine reboots.

service iptables save

NRPE commands

You can test some of these

by running the following commands:

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_users

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_load

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_hda1

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_total_procs

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_zombie_procs

Now back to your Nagios Server , and Install NRPE deamon :

Download nrpe and extract.

/configure
make all

Install the NRPE plugin

make install-plugin

check of nrpe is working we will check the nrpe in the remote host 10.1.1.56 :

[root@Nagios-Server nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 10.1.1.56

NRPE v2.12

Now in the nagios server :

Go to

Cd /usr/local/nagios/etc/objects
Cp linux-server.cfg linux-remotemachine.cfg

Open linux-remotemachine.cfg and edit the hostname and IP adress

Save exit

Cd /usr/local/nagios/etc

vi nagios.cfg

Add this line :

# Definitions for monitoring the local (Linux) host

#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

cfg_file=/usr/local/nagios/etc/objects/Nagios-server.cfg

cfg_file=/usr/local/nagios/etc/objects/remote-machine.cfg

save and exit

hehehe Almost done :D !! whats next??? :

Let us check if you nagios server nagios can start without errors

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


Any questions??? Shoot them :D


Regards,

Konstantine Gorshkov
RHCE - (RHEL 5),ITSEH ,CCNA
Knowledge shared = =  knowledge doubled

===================================================================

Thanked by 2 Members:
chall1600 , harry817





Recent blog entries on this topic

Photo

From: Installing Nagios on RHEL 5

By konstantine in All About Linux , on 17 August 2010 - 01:50 PM

Hello CC's

Many of my CC friend asked me the procedure of installing nagios!!!

I tried for that so have a look........

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...

Read Full Entry →

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Organization

Community

Downloads

Test Providers

Site Info


Go to top