*** Check the #Comments in the file to understand the options I used. *** *** This is a pretty full nrpe.cfg file, you may want to remove unnecessary check_command‘s, I use them all. ***

Next, Let’s edit /etc/sudoers and add the following lines:

nano /etc/sudoers

Defaults:nagios !requiretty # Allows for nagios user (The user NRPE uses) to not require a tty.
nagios ALL = NOPASSWD:/usr/lib64/nagios/plugins/* # Allows nagios user to run all NRPE plugins using sudo without entering a password.

Make nagios the owner of /etc/nagios and /usr/lib64/nagios/plugins folders:

Step 5 – Configuring IPtables to allow NRPE connections:

In order to allow NRPE to accept connections, you’ll need to open the relevant port in your machine’s firewall:

# iptables -I INPUT -p tcp -m tcp --dport 5666 -j ACCEPT

Step 6 – Set NRPE agent service to start on boot and start it manually now

Run the next command:

# chkconfig nrpe on ; service nrpe start

Step 7 – Testing NRPE

The first test I always do allows me to see if the NRPE agent is responding:

# /usr/lib64/nagios/plugins/check_nrpe -H localhost

This is the response you’re supposed to get:

NRPE local check

Then run the same check from the Nagios server:

NRPE remote check

If both checks returned the NRPE version then it means that the NRPE agent is installed and configured correctly on the monitored host. It also means that there’s a clean connection between the two servers and that the monitored host’s port 5666 is opened and listening.

Now you can start checking the monitored host using other checks, for example, in order to check how much disk space left on the monitored server “/” mount point:

NRPE remote check disk

Troubleshooting

Troubleshooting NRPE could be annoying but as with all other Linux projects, it takes a typo to break the whole deal, so always remember to check everything all over again. I’ll give you some examples to how I start troubleshooting NRPE problems, it really depends on the error you receive but here are some basic guide lines:

4. Make sure that the plugins which are in the plugins folder of the Nagios server also exist on the plugins folder of the Monitored server. 5. When a check fails against a remote host where you just finished configuring NRPE, run the check against a server where you know for sure the NRPE is working properly. 6. If you went through all these steps and are still having a problem, use the next document:

For those of you who wish to shorten the procedure, please use the following script that I have made: