Search


Tuesday, November 22, 2011

NRPE Installation


The NRPE addon is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. This allow Nagios to monitor "local" resources (like CPU load, memory usage, etc.) on remote machines


Nagios NRPE Installation and Configuration

NRPE Installation

 

 Install nagios-nrpe & nagios-plugins using yum.
 Change the "allowed_hosts" value to the IP of nagios server in /etc/nagios/nrpe.cfg


yum install nagios-nrpe nagios-plugin-nrpe
chkconfig nrpe on
/sbin/chkconfig --list
ls /usr/lib/nagios/plugins
nano /etc/nagios/nrpe.cfg
allowed_hosts= local host  -- as the connection need to be established with the server itself
/etc/init.d/nrpe restart 
 
 
Port 5666 need to be opened for nagios

/sbin/iptables -I INPUT -p tcp -m tcp --dport 5666 -j ACCEPT

 

I am briefing the  NRPE  motoring with the help of an example.   Assume we are trying to implement a distributed monitoring.   

Master Server :-  Monitoring server          :   A
Remote server :- Server  to be monitored :   Z

Master server is having   Nagios ,  Nagios-nrpe,  nagios-plugin-nrpe, hostgroups,  servers 

Host Group:  A host group definition is used to group one or more hosts together for simplifying configuration   

define hostgroup {

hostgroup_namehostgroup_name

aliasalias

membershosts

hostgroup_membershostgroups

notesnote_string

notes_urlurl

action_urlurl

Example of   "/etc/nagios/hostgroups/hostgroup.cfg"
 
define hostgroup  {
hostgroup_name    Google Linux
alias             Google
members           host1, host2 
} 
 
 
Servers:  The servers and the services that are being monitored using the Monitoring server A (main nagios server). 
example:   /etc/nagios/servers/"host1.cfg"
The "host1" file is used to specify which services need to be monitored in the  remote server "host1"
This file contains the definition of the services that need to be checked.
example: /etc/nagios/servers/google.cfg
define service{
        use                             local-service         
        host_name                       google.cfg
service_description             HTTP
        check_command                   check_http
        notifications_enabled           1
        }
check_command: This directive is used to specify the short name of the command that Nagios will run in order to check the status of the service.
The maximum amount of time that the service check command can also mentioned after check_command 
 
notifications_enabled:  This directive is used to determine whether or not notifications for this host are enabled. Values: 
0 = disable host notifications, 
1 = enable host notifications.
 
We have to define all the services that need to be checked/ monitored separately ie each  check_command will have separate  definition 
 
example of check command:  check_mysql -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d $ARG3$
 
check_command   check-host-alive
 
check_mysql!powerdns_services!NmLY6DeM2Zvt2fUW!powerdns
 
check_mysql is defined in the remote host, ie the service need to monitored
 $ARG1$ is powerdns_services, 
$ARG2$ is NmLY6DeM2Zvt2fUW,
$ARG3$ is powerdns
 
You can refer the page for more definitions  http://nagioswiki.com/wiki/index.php/Checking_NT_Services_with_Nagios
 
 
 
 

Monitoring Load

nano /etc/nagios/nrpe.cfgcommand[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,10 -c 30,25,20


/etc/init.d/nrpe restart



 

2 comments:

  1. I follow above the steps to instal NRPE server. I get it clear idea about your topic.Above all the points are explained very clearly.Reading this kind of article is worthy.hosting server

    ReplyDelete
  2. Thanks webhosting. Keep visiting :)

    ReplyDelete