How to Install NRPE from EPEL on Centos / RHEL 6

On the client

Install EPEL repository

Red Hat 6

rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS

yum install epel-release

Install requires packages

yum install nrpe nagios-plugins-all openssl

Add the Nagios server IP

vi /etc/nrpe.d/allowed_hosts.cfg

allowed_hosts=192.168.100.26

/etc/init.d/nrpe start

Add HTTP service

vi /etc/nagios/nrpe.cfg

command[check_http]=/usr/lib64/nagios/plugins//check_http -I 192.168.100.22

/etc/init.d/nrpe restart

Configure iptables

vi /etc/sysconfig/iptables

-A INPUT -s 192.168.100.26 -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT

vi /init.d/iptables restart

On nagios server

Install NRPE plugin

yum install nagios-plugins-nrpe

Create the directory

mkdir /etc/nagios/servers

Edit nagios configuration file

vi /etc/nagios/servers

cfg_dir=/etc/nagios/servers

Add check_nrpe command

vi /etc/nagios/objects/commands.cfg

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

Create the hostgroup

vi /etc/nagios/servers/hostgroups.cfg

define hostgroup{
        hostgroup_name  linux-servers
        alias           Linux Servers
        members         client
        }

Create the configuration for client

vi /etc/nagios/servers/client.cfg

define host{
        use                     linux-server
        host_name               client
        alias                   client
        address                 192.168.100.22
        hostgroups              linux-servers
        }

define service{
        use                             local-service
        host_name                       client
        service_description             HTTP
        check_command                   check_nrpe!check_http
        notifications_enabled           0
        }

Check configuration

/etc/init.d/nagios checkconfig

Restart nagios

/etc/init.d/nagios restart

Test the connection

/usr/lib64/nagios/plugins/check_nrpe -H 192.168.100.22 -c check_http