How To Add Linux Host To Nagios Using NRPE Plugin

In the previous article, we already explain how to add Linux host to Nagios but we do not use Nagios plugin to do that. Now, we want to add Linux host to Nagios using Nagios plugin called NRPE or Nagios Remote Plugin Executor. NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines and monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with some of the Windows agent add-ons, so you can execute scripts and check metrics on remote Windows machines as well. In this article, we want to add Linux centOS 7 to Nagios with IP 192.168.56.102 using NRPE and IP Nagios Server is 192.168.56.101. Please disable SELinux and IPTables on each server.

A. On Remote Host

Type these commands to install required dependencies and install Nagios plugin:

After that, we will install NRPE plugin in the Linux Host:

Then, we must update services file in the host:

Hereafter, we must add IP of Nagios server in /usr/local/nagios/etc/nrpe.cfg file:

Then, we turn on NRPE plugin with these commands:

Type these commands to check whether NRPE has been work or not in the host:

Make sure there is no error when we type those commands and if we got results like this:
nrpe
NRPE plugin has been installed successfully on the host.

B. On Nagios Server
Type these commands to install required dependencies and install NRPE plugin on Nagios server:

Add the script below in /usr/local/nagios/etc/nagios.cfg file:

Then, add the script below in /usr/local/nagios/etc/hosts.cfg file:

Later, add the script below in the /usr/local/nagios/etc/services.cfg file:

And then, add the script below in /usr/local/nagios/etc/objects/commands.cfg file:

After that, type these commands and make sure there is no error after type these commands:

Open Nagios Monitoring in the browser and it should Linux host will appear in Nagios.

And on the Services page will display like this:

If you want to enable IPTables on server or Linux host using centOS 7, type these commands to prevent IPtables from blocking the NRPE port:

References:
tecmint.com
exchange.nagios.org
support.nagios.com

Leave a Reply

Your email address will not be published. Required fields are marked *