NRPE - Agent and Plugin Explained


Nagios Remote Plugin Executor (NRPE) is an agent used by Nagios XI for communicating with remote hosts. Remote hosts are operating systems like Linux and Windows.


This KB article explains:


The purpose of this KB article is to give you an understanding of how the technology works, which in turn will help you with troubleshooting problems with NRPE.




It is important to clearly define the terminology used in this KB article.

This KB article provides detailed information including screenshots from Nagios XI. The concepts explained in this documentation are also applicable to Nagios Core.




Nagios XI Server






This KB article will assume that NRPE and the plugins are installed in the default directories. If your corporate build or repo installed NRPE or the Nagios-plugins to a different directory than the default location, you will have to make note and substitute your paths for those in this KB article.  The directories referenced most in this KB article are /usr/local/nagios/libexec/ and /usr/local/nagios/etc/.


NRPE Explained

Nagios XI is what sends requests to the agent so the first step is to look at an NRPE service in Core Configuration Manager (CCM). Here is a screenshot from a service definition in Nagios XI CCM.



You can see how the Command view shows the Nagios XI command being used. The variables $USER1$, $HOSTADDRESS$, $ARG1$ and $ARG2$ are dynamically inserted into the command when Nagios XI executes the check.

Here is that same command after the variables have been replaced with the real values:

/usr/local/nagios/libexec/check_nrpe -H -t 30 -c check_users -a '-w 5 -c 10'

What does this mean? The two important options explained here are:


On the agent, where is the check_users command defined?

Commands are defined in the nrpe.cfg file, this is commonly located at /usr/local/nagios/etc/nrpe.cfg.

They may also be defined in an additional .cfg file referenced in the nrpe.cfgfile, for example:



What does a command definition look like? Using the example above, the check_users command is defined as follows:

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$


Using the example of the request sent by the Nagios XI server, the remote server will execute the following command:

/usr/local/nagios/libexec/check_users -w 5 -c 10

You can see that the $ARG1$ variable has been replaced with -w 5 -c 10.

It's a simple as that.


There was a statement made earlier that requires further explanation. In relation to the value of $ARG2$ in the following screenshot:






Nagios XI and NRPE both use "variables" or "macros" as a way of creating dynamic configurations.

It is important to remember that the $ARGx$ variable you see in a configuration is directly related to the configuration you are looking at.

Looking at this screenshot:



$ARG2$ in this screenshot contains the values that make up part of the Nagios XI service configuration.



Using the example above, the check_users command is defined as follows:

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$


It can be easy to mix up the arguments on the Nagios XI server with the arguments in the agent configuration. A common mistake is:




Final Thoughts

This completes the explanation of how the NRPE Agent and Plugin works.

For any support related questions please visit the Nagios Support Forums at:

Article ID: 612
Created On: Fri, Jul 14, 2017 at 1:03 AM
Last Updated On: Fri, Jul 14, 2017 at 3:15 AM
Authored by: tlea

Online URL: