image

On server Side

1.download package of libraries gcc, gd gd-devdl ,glibc glibc-common, libpng-devel libjpeg devel

[root@whq-nagios ~]# yum install gcc
[root@whq-nagios ~]# yum install glibc glibc-common
[root@whq-nagios ~]# yum install gd gd-devel
[root@whq-nagios ~]# yum install libpng-devel
[root@whq-nagios ~]# yum install libjpeg-devel

2. add users and group of nagios

[root@whq-nagios ~]# useradd nagios
[root@whq-nagios ~]# mkdir /usr/local/nagios
[root@whq-nagios ~]# mkdir /usr/local/nagios/libexec
[root@whq-nagios ~]# chown -R nagios:nagios /usr/local/nagios
[root@whq-nagios ~]# groupadd nagcmd
[root@whq-nagios ~]# usermod G nagcmd apache
[root@whq-nagios ~]# usermod G nagcmd nagios
[root@whq-nagios ~]# chgrp R nagcmd /usr/local/nagios/var/rw
[root@whq-nagios ~]# mkdir /root/nagiosinstall

3.Download the full package of nagios
Package Location for getting the file
nagios-3.0.1.tar.gz http://www.nagios.org/download/
nrpe-2.12.tar.gz  http://www.nagios.org/download/
nagios-plugins-1.4.11.tar.gz http://www.nagios.org/download/

a) Extracting all the packages of nagios in /root/nagiosinstall

[root@whq-nagios ~]# cd /root/nagiosinstall/
[root@whq-nagios nagiosinstall]# tar -xvzf nagios-3.0.1.tar.gz
[root@whq-nagios nagiosinstall]# tar -xvzf nagios-plugins-1.4.11.tar.gz

4. Install the package of perl and extracting it
a) download package of nagios-plugin-perl-1.4.8.7.fc8.i386.rpm and install the rpm
b) After that install other packages of perl through yum
and extracting all the packages which are in /nagiosinstall/nagios-plugin-1.4.11/perlmode

[root@whq-nagios nagiosinstall]# yum install nagios-plugins-perl

c) extracting all the packages which are in /nagiosinstall/nagios-plugin-1.4.11/perlmode run following commands

[root@whq-nagios nagiosinstall ]#cd nagios-plugins-1.4.11
[root@whq-nagios-plugin-1 ~.4.11]cd perlmode
[root@whq-nagios perlmode]# tar -xvzf Class………………tar.gz
[root@whq-nagios perlmode]# cd Class……..
[root@whq-nagios Class]# perl Makefile.PL
[root@whq-class]# make
[root@whq-nagios Class] # make test
[root@whq-nagios Class] # make install

* Note:- we have to install all packages in permodes directory one by one.

5.Install the package of nagios-3.0.1

root@whq-nagios ~]# cd /root/nagiosinstall
root@whq-nagios nagiosinstall]# tar xzvf nagios-3.0.1.tar.gz
root@whq-nagios nagiosinstall]# cd nagios-3.0.1
root@whq-nagios nagios-3.0.1]# ./configure –prefix=/usr/local/nagios –with-cgiurl=/nagios/cgi-bin –with-htmurl=/nagios \
–with-nagios-user=nagios –with-nagios-group=nagios –with-command-group=nagcmd

root@whq-nagios nagios-3.0.1]# make all
root@whq-nagios nagios-3.0.1]# make install
root@whq-nagios nagios-3.0.1]# make install-init
root@whq-nagios nagios-3.0.1]# make install-commandmode
root@whq-nagios nagios-3.0.1]# make install-config
root@whq-nagios nagios-3.0.1]# make install && make install-init
root@whq-nagios nagios-3.0.0.1]# make install-commandmode
root@whq-nagios nagios-3.0.1]# make install-config

6.Install package of nagios-plugins

[root@whq-nagios nagios-3.0.1]# cd /root/nagiosinstall/nagios-plugins.1.4.11
[root@whq-nagios nagios-plugins.1.4.11]#./configure –enable-perl-modules
[root@whq-nagios nagios-plugins.1.4.11]# make
[root@whq-nagios nagios-plugins.1.4.11]# make all
[root@whq-nagios nagios-plugins.1.4.11]# make install

7.Create your apache server
a)Now we must configure Apache for the Nagios Monitoring web site. The first thing we need to do is add following lines

[root@whq-nagios nagios-plugins.1.4.11]# vi /etc/httpd/conf/httpd.conf
<VirtualHost nagios.abc.com>
ServerAdmin root@nagios.abc.com
DocumentRoot /usr/local/nagios/share
ServerName nagios.abc.com
ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin/”
<Directory “/usr/local/nagios/sbin/”>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios “/usr/local/nagios/share/”
<Directory “/usr/local/nagios/share/”>
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
</VirtualHost>

b) Create a file with the name /usr/local/nagios/sbin/.htaccess. Insert the following into that file:

[root@whq-nagios nagios-plugins.1.4.11] vi /usr/local/nagios/sbin/.htaccess

AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

c)Create a nagiosadmin user account that will be used when prompted for authentication when accessing the Nagios web page:

[root@whq-nagios nagios-plugins-1.4.11]#useradd nagiosadmin
[root@whq-nagios nagios-plugins-1.4.11]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

8.Using a text editor modify the /usr/local/nagios/etc/commands.cfg file and add the following to the top of the file:

[root@whq-nagios nagios-plugins.1.4.11] vi /usr/local/nagios/etc/commands.cfg
# ‘check_nrpe’ command definition
define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$
}

Also change:
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
to
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$
Using a text editor modify the /usr/local/nagios/etc/nagios.cfg file. Set the check_external_commands to 1

9.using your preferred editor open the cgi.cfg file and change and/or un-comment the following:

[root@whq-nagios nagios-plugins.1.4.11] vi /usr/local/nagios/etc/cgi.cfg
authorized_for_system_information=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin

[root@whq-nagios etc]# service httpd restart
Test your Nagios configuration by doing the following:

root@whq-nagios etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
root@whq-nagios etc]# service nagios start

Client Configuration:

root@whq-nagiosclient ~]# mkdir /usr/local/nagios
root@whq-nagiosclient ~]# mkdir /root/nagiosinstall
Once the directory is created download the following two files to the nagiosinstall directory:
Package Location for getting the file
nrpe-2.5.2.tar.gz  http://www.nagios.org/download/
nagios-plugins-1.4.3.tar.gz http://www.nagios.org/download/
[root@whq-nagiosclient ~]# yum install gcc
[root@whq-nagiosclient ~]# yum install glibc glibc-common
[root@whq-nagiosclient ~]# yum install gd gd-devel
[root@whq-nagiosclient ~]# yum install libpng-devel
[root@whq-nagiosclient ~]# yum install libjpeg-devel

First, unzip the nrpe-2.5.2.tar.gz file by doing the following:
root@whq-nagiosclient ~]# cd /root/nagiosinstall
root@whq-nagiosclient nagiosinstall]# tar xzvf nrpe-2.5.2.tar.gz

Second thing is that extracting all the packages which are in /nagiosinstall/nagios-plugin-1.4.11/perlmode run following commands

[root@whq-nagiosclient ~]# cd nagios-plugins-1.4.11
[root@whq-nagiosclient ~]# cd perlmode
[root@whq-nagiosclient ~]# tar -xvzf Class………………tar.gz
[root@whq-nagiosclient ~]#cd Class……..
[root@whq-nagiosclient ~]# perl Makefile.PL
[root@whq-nagiosclient ~]# make
[root@whq-nagiosclient ~]# make test
[root@whq-nagiosclient ~]# make install
[root@whq-nagiosclient ~]./configure –enable-perl-modules
[root@whq-nagios nagios-plugins.1.4.11]# make
[root@whq-nagios nagios-plugins.1.4.11]# make all
[root@whq-nagios nagios-plugins.1.4.11]# make install

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

commands.
[root@whq-nagios nagios-plugins.1.4.11]#
[root@whq-nagios nagios-plugins.1.4.11]#chown nagios.nagios /usr/local/nagios[root@whq-nagios nagios-plugins.1.4.11]#chown -R nagios.nagios /usr/local/nagios/libexec

Install xinetd
Fedora Core 6 doesn’t ship with xinetd installed by default, so install it with the following command:

#yum install xinetd

root@whq-nagiosclient ~]# cd /root/nagiosinstall/
root@whq-nagiosclient ~tar xzf nrpe-2.8.tar.gz
cd nrpe-2.8
compile the NRPE addon.
[root@whq-nagiosclient ~]#./configure –enable-perl.modules
[root@whq-nagiosclient ~]# make all

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

[root@whq-nagiosclient ~]# make install-plugin
[root@whq-nagiosclient ~]# make install-daemon
root@whq-nagiosclient ~]#make install-daemon-config

Install the NRPE daemon as a service under xinetd.

[root@whq-nagiosclient ~]# 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 <nagios_ip_address>
Add the following entry for the NRPE daemon to the /etc/services file.
nrpe 5666/tcp # NRPE

Restart the xinetd service.
service xinetd restart

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 it does, great! If it doesn’t, make sure of the following
[root@whq-nagiosclient ~]#/usr/local/nagios/libexec/check_nrpe -H localhost

You should get a string back that tells you what version of NRPE is installed, like this:
NRPE v2.8

Server Configuration
# cd /root/nagiosinstall/nrpe-2.11

Compile the NRPE addon.
./configure
make all
Install the NRPE plugin.
make install-plugin
Using your favorite editor open the /usr/local/nagios/etc/nrpe.cfg file for modification. Change the following line from:
dont_blame_nrpe=0
to
dont_blame_nrpe=1
command[check_local_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

command[check_local_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$

command[check_local_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$

command[check_local_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$

command[check_ping]=/usr/local/nagios/libexec/check_ping -H $ARG1$ -w $ARG2$ -c $AGR3$ -p 5

Save and exit.

root@whq-nagiosclient ~]# useradd nagios

root@whq-nagiosclient ~]# chown R nagios /usr/local/nagios

Start the NRPE client:
root@whq-nagiosclient ~]# /usr/local/nagios/nrpe -c /usr/local/nagios/nrpe.cfg -d

From the Nagios Server:

[root@whq-nagiosinstall]# tar xzf nrpe-2.11.gz

cd nrpe-2.11
[root@whq-nagios nrpe-2.11]#./configure
[root@whq-nagios nrpe2.11] # make
[root@whq-nagios nrpe-2.11]# make install
[root@whq-nagios nrpe-2.11]# make install-plugin
[root@whq-nagios nagios-plugins-1.4.11]# cp /root/nagiosinstall/nrpe-2.11/src/check_nrpe /usr/local/nagios/libexec

If you didn’t do so above in the server configuration, add the following to the top of the check command.cfg file on your Nagios Server:

Restart the nagios service:

Leave a Reply