HowTo Install NRPE Configure Ubuntu Nagios Client

In Previous Article we explained how to install Nagios Server in RHEL 7/Centos 7 Step by Step. After successful installation of Nagios we have Howto install NRPE configure Ubuntu Nagios Client to monitor various services. In this Article I am going to show you detailed steps to install and configure NRPE in Ubuntu Linux.

NRPE=Nagios Remove Plugin Executor. Using check_nrpe plugin Nagios Server will communicate with Nagios client and execute remote commands and monitor associated/required components status. Communication in between Server and client in secured by SSL/TLS.

Nagios Client nrpe

Nagios Client nrpe Communication

Open Firewall Ports

If server and client is located in different networks then you have to open 5666, 5667 and 5668 ports in firewall for communication.

1 Step: HowTo Install NRPE Packages in Ubuntu

Nagios/NRPE packages are available in default Ubuntu repository no need of configuring additional repositories to Install NRPE Configure

$ sudo apt-get install nagios-nrpe-server nagios-plugins

Suggested packages:
libcrypt-des-perl icinga | icinga | nagios3 nagios-plugins-contrib fping qstat python-crypto-dbg python-crypto-doc heimdal-clients cifs-utils

NEW packages will be installed:
libdbi1 libnet-snmp-perl libpq5 libtirpc1 monitoring-plugins monitoring-plugins-basic monitoring-plugins-common monitoring-plugins-standard nagios-nrpe-server nagios-plugins python-crypto python-ldb python-samba python-tdb rpcbind samba-common samba-common-bin smbclient snmp

2 Step: Configuring NRPE

Installation is done, to communicate or send data to Nagios server or querying remote client from server required little bit of configuration in Nagios Client.

Edit configuration file

vi /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.2.28

This is an optional comma-delimited list of IP address or hostnames that are allowed to talk to the NRPE daemon. Network addresses with a bit mask (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently supported.

Note: The daemon only does rudimentary checking of the client’s IP address. I would highly recommend adding entries in your /etc/hosts.allow file to allow only the specified host to connect to the port you are running this daemon on.

Restart Service to effect configuration

root@arkit-nagios-client:/# /etc/init.d/nagios-nrpe-server restart
[ ok ] Restarting nagios-nrpe-server (via systemctl): nagios-nrpe-server.service.

3 Step: Verify Client from Nagios Server

[aravi@arkit-nagios-server ~]$ cd /usr/local/nagios/libexec/
[aravi@arkit-nagios-server libexec]$ ./check_nrpe -H 192.168.2.100
NRPE v2.15

Execute NRPE check from Nagios server and confirm that NRPE is able to send reply

4 Step: Configure Services for Monitoring

Here are few commands configured in NRPE client to Monitor Disk Space, CPU Stats, LOAD, Memeory usage, Patch Update status, Running Processes, Connected users and zombie processes.

root@arkit-nagios-client:~# cat /etc/nagios/nrpe.cfg |grep check
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
command[check_apt]=/usr/lib/nagios/plugins/check_apt
command[check_cpu_stats]=/usr/lib/nagios/plugins/check_cpu_stats
command[check_init_cron]=/usr/lib/nagios/plugins/check_init_service cron
command[check_init_ssh]=/usr/lib/nagios/plugins/check_init_service ssh
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
command[check_mem]=/usr/lib/nagios/plugins/check_mem -w $ARG1$ -c $ARG2$
command[check_open_files]=/usr/lib/nagios/plugins/check_open_files -w $ARG1$ -c $ARG2$

After configuration commands in client go to Nagios server and deploy Host definition and services definitions. After configuring you may see few errors in Nagios.

CHECK_NRPE: Recieved 0 bytes from daemon. Check the remote server logs for error messages

Error Received 0 bytes from daemon Nagios

Error Received 0 bytes from daemon Nagios

root@arkit-nagios-client:/# netstat -at | grep nrpe
tcp 0 0 arkit-nagios-client.c:nrpe arkit-nagios-server:37384 TIME_WAIT
tcp6 0 0 [::]:nrpe [::]:* LISTEN

root@arkit-nagios-client:/# cat /etc/services | grep 566[6-8]
nrpe 5666/tcp # Nagios Remote Plugin Executor
nsca 5667/tcp # Nagios Agent - NSCA

To resolve above error edit config file /etc/nagios/nrpe.cfg and make below change

from

dont_blame_nrpe=0

to

dont_blame_nrpe=1

restart nagios-server service. Verify nrpe service should LISTEN state.

root@arkit-nagios-client:/# netstat -at | grep nrpe
tcp6 0 0 [::]:nrpe [::]:* LISTEN

That’s it. HowTo Install NRPE Configure Ubuntu Nagios Client.

Related Articles

NSclient Installation

Nagios-Core Installation RHEL 7

PNP4NAGIOS graphing service

For more plugins

Thanks for your wonderful Support and Encouragement

ARK

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published.