### OS - CentOS 7 64bit                 
### IP - 172.17.25.100                  
### Hostname - webserver.example.com
Step 1:
Setup NRPE Service on Linux Host
vi /etc/hosts
Install Package & Plugin 
yum install epel*
yum install nrpe nagios-plugins* # CentOS/RHEL/Fedora
OR
apt-get install nagios-nrpe-server nagios-plugins # Debian/Ubuntu/LinuxMint
Step 2: 
Configure NRPE
vi /etc/nagios/nrpe.cfg
#Add Nagios Server IP
allowed_hosts=127.0.0.1, 172.17.20.100
#Allow Argument 
# Values: 0=do not allow arguments, 1=allow command arguments
dont_blame_nrpe=1
Step 3:
Add Command
# The following examples use hard-coded command arguments...
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_root]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/centos-root
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20 -c 10
command[check_http]=/usr/lib64/nagios/plugins/check_http -H 172.17.20.103
Step 4:
Restart Service
systemctl restart nrpe.service
or
service nrpe restart
or
sudo /etc/init.d/nagios-nrpe-server restart
## Allow on Firewalld
firewall-cmd --add-port=5666/tcp --permanent
firewall-cmd --reload
### Server Side Configuration ######
### OS - CentOS 7 64bit       ######
### IP - 172.17.25.200       #####
### Hostname - nagios.linuxtopic.com ####
Step 5:
## Install nrpe
yum install openssl-devel xinetd unzip
# Download nrpe
cd /tmp
curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar xvf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagiosgroup --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
make all
make install
make install-xinetd
make install-daemon-config
# Test nrpe client
telnet <client ip> 5666
/usr/local/nagios/libexec/check_nrpe -H 172.17.25.100
Step 6:
 # Configure HOST
vi /usr/local/nagios/etc/servers/webserver.linuxtopic.cfg
## Host Details ###
define host {
        use                                   linux-server
        host_name                       webserver.linuxtopic.com
        alias                                 MyWeb
        address                           172.17.20.103
        max_check_attempts       10
        check_period                    24x7
        notification_interval           10        # Notification
        notification_period             24x7
}
# Define Group
define hostgroup{
        hostgroup_name             Webserver_Group
        alias                                 MyWebserver
#     members                        172.17.20.103
        }
####
# Check Ping
define service {
        use                                 generic-service
        host_name                       webserver.linuxtopic.com
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        check_interval                  1    # 1 min
        retry_interval                  1    # 1 min
}
# Define a service to check the load on the local machine.
define service{
        use                                 local-service
        host_name                       webserver.linuxtopic.com
        service_description             Current Load
        check_command                   check_nrpe!check_load!15.0,12.0,10.0!20.0,18.0,15.0
        check_interval                  1
        retry_interval                  1
        }
# Check Users
define service{
        use                            generic-service
        host_name                  webserver.linuxtopic.com
        service_description         Current Users
        check_command             check_nrpe!check_users
        check_interval                1
        retry_interval                1
}
# Check Process
define service{
        use                                 local-service
        host_name                       webserver.linuxtopic.com
        service_description             Total Processes
        check_command                   check_nrpe!check_total_procs!250!400!RSZDT
        check_interval                  1
        retry_interval                  1
}
# Check Root Part.
define service{
        use                                local-service
        host_name                       webserver.linuxtopic.com
        service_description             Disk-Root-Partition
        check_command                   check_nrpe!check_root!10%!5%!/
        check_interval                  1
        retry_interval                  1
 }
# 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
        host_name                       webserver.linuxtopic.com
        service_description             Disk-Swap-Partition
        check_command                   check_nrpe!check_swap!20!10
        check_interval                  1
        retry_interval                  1
}
## Check HTTP Server
define service{
        use                                 local-service
        host_name                       webserver.linuxtopic.com
        service_description             WEB-HTTP
        check_command                   check_nrpe!check_http
        check_interval                  1
        retry_interval                  1
 }
Part 1: Nagios Core 4.X configuration in Linux
Part 2: Add Remote hosts and service in Nagios
Part 3: Monitor MySQL/MariaDB Using check_mysql Plugin
Part 4: Monitor Tomcat using check_tomcat Plugin

