Configuration of linux client on Nagios Server

Nagios is an efficient network monitoring tool. This allows you to monitor company network, routers, switches, servers and other applications etc. There are many plugins that are available and its immense community makes Nagios the largest open source monitoring tool. Here we are going to see about the configuration of  linux  client on nagios server.

Steps :

Step 1 : Install Nagios-plugin and nrpe add-on on client side.

Step 2 : Then edit the nrpe by adding IP address of the monitoring server

Step 3 : Modify the /etc/services and add the following at the end of the file.

Step 4 : To verify NRPE is functioning properly.

Step 5 : After completing all the above steps on the linux-client side, know you have to install the check_nrpe plugin on server side.

Step 6 : Know add some services in localhost.cfg to monitor the linux-client services.

Step 7 : Verify your configuration files.

Let us see the steps in Details :

Step 1 : Install Nagios-plugin and nrpe add-on on client side.

i. Create Nagios account

#useradd nagios          

#passwd nagios

ii. To install Nagios-plugin

#cd  ~/downloads

#wget https://www.nagios-plugins.org/download/nagios-plugins-1.4.16.tar.gz

#tar -zxvf nagios-plugins-1.4.16.tar.gz           

#cd nagios-plugins-1.4.16           

#./configure 

#make

#make install

#chown nagios.nagios/usr/local/nagios

#chown -R nagios.nagios/usr/local/nagios/libexec

iii. Install xinetd

#yum install xinetd

iv. To install nagios NRPE :

#yum install nagios-nrpe

Or download from

#wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download?use_mirror=hivelocity&r=&use_mirror=hivelocity

#tar xvfz nrpe-2.15.tar.gz            

#cd nrpe-2.15            

#./configure  (Here, if there is any then Goto configure step again

#./configure –with-ssl-lib=/usr/lib/i386-linux-gnu/

#make all

#make install-plugin

#make install-daemon

#make install-daemon-config

#make install-xinetd

#service xinetd restart

Step 2 : Then edit the nrpe by adding IP address of the monitoring server

#vi /etc/xinetd.d/nrpe

only_from      127.0.0.1    change to nagios server ip 192.168.1.4

#chkconfig nrpe on

#/etc/init.d/nrpe start

#vi /etc/services

Step 3 : Modify the /etc/services and add the following at the end of the file.

nrpe   5666/tcp     #NRPE

#netstat –at |grep nrpe

Check the given ports are working

Step 4 : To verify NRPE is functioning properly.

#/usr/local/nagios/libexec/check_nrpe -H 192.168.1.11

output

NRPE v2.15

Step 5 : After completing all the above steps on the linux-client side, know you have to install the check_nrpe plugin on server side.

#cd ~/downloads/

#wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download?use_mirror=hivelocity&r=&use_mirror=hivelocity

#tar xvfz nrpe-2.15.tar.gz

#./configure

#make all

#make install-plugin

Edit commands.cfg file to work with check_nrpe plugin:

#vi /usr/local/nagios/etc/commands.cfg

And add

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $192.168.1.11$ -c $ARG1$
}

Save your changes and exit

Step 6 : Know add some services in localhost.cfg to monitor the linux-client services.

# Define a host for the local machinedefine host{use                     linux-server          ; Name of host template to use
; This host definition will inherit all variables that are defined; in (or inherited by) the linux-server host template definition.host_name               linux-server
alias                          linuxhost
address                   192.168.1.11
}SERVICE DEFINITIONS
# Define a service to “ping” the local machine
define service{
use                                     local-service        ; Name of service template to use
host_name                        linux-server
service_description             PING
check_command                   check_ping!100.0,20%!500.0,60%
}

# Define a service to check the disk space of the root partition
# on the local machine.  Warning if < 20% free, critical if
# < 10% free space on partition.

define service{
use                                   local-service         ; Name of service template to use
host_name                       linux-server
service_description          Root Partition
check_command              check_local_disk!20%!10%!/
}
# Define a service to check the number of currently logged in
# users on the local machine.  Warning if > 20 users, critical
# if > 50 users.

define service{
use                                   local-service        ; Name of service template to use
host_name                       linux-server
service_description          Current Users
check_command              check_local_users!20!50
}

# Define a service to check the number of currently running procs
# on the local machine.  Warning if > 250 processes, critical if
# > 400 users.

define service{
use                                   local-service        ; Name of service template to use
host_name                       linux-server
service_description          Total Processes
check_command              check_local_procs!250!400!RSZDT
}

# Define a service to check the load on the local machine.

define service{
use                                   local-service        ; Name of service template to use
host_name                       linux-server
service_description          Current Load
check_command             check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}

# Define a service to check the swap usage the local machine.
# Critical if less than 10% of swap is free, warning if less than 20% is free

define service{
use                                   local-service        ; Name of service template to use
host_name                       linux-server
service_description          Swap Usage
check_command              check_local_swap!20!10
}

# Define a service to check SSH on the local machine.
# Disable notifications for this service by default, as not all users may have SSH enabled.

define service{
use                                   local-service        ; Name of service template to use
host_name                       linux-server
service_description          SSH
check_command             check_ssh
notifications_enabled           0
}

# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.

define service{
use                                   local-service        ; Name of service template to use
host_name                       linux-server
service_description           HTTP
check_command              check_http
notifications_enabled           0
}

Step 7 : Verify your configuration files

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

Restart Nagios and you can check on a web interface to monitor the Linux client which can be seen in the figures below.

#service nagios restart

 

 

 For more details you can watch video and also subscribe for more Videos :

Both comments and pings are currently closed.

One Response to “Configuration of linux client on Nagios Server”

  1. Ramesh says:

    Excellent post !

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk