
= NrpeMonitor
:description: Learn about the NrpeMonitor in OpenNMS {page-component-title} that lets you test plugins and checks running on the Nagios Remote Plugin Executor framework.

The NrpeMonitor lets you test plugins and checks running on the link:https://exchange.nagios.org/directory/Addons/Monitoring-Agents/[Nagios Remote Plugin Executor] (NRPE) framework.

{page-component-title} and Nagios have several conceptional differences.
In {page-component-title}, a service can only be available or not available and the response time for the service is measured.
Nagios, on the other hand, combines service availability, performance data collection, and thresholding in one check command.
For this reason, a Nagios check command can have more states than OK and CRITICAL.
Using the NrpeMonitor marks all check command results other than OK as DOWN.
The full output of the check command output message is passed into the service down event in {page-component-title}.

IMPORTANT: NRPE configuration on the server is required and the check command has to be configured; for example, `command[check_apt]=/usr/lib/nagios/plugins/check_apt`

CAUTION: {page-component-title} runs every NRPE check in a Java thread without `fork()` a process, and is more resource friendly.
         Nevertheless, it is possible to run NRPE plugins that combine a lot of external programs like sed, awk, or cut.
         Be aware that each command forks additional processes.

== Monitor facts

[cols="1,7"]
|===
| Class Name
| `org.opennms.netmgt.poller.monitors.NrpeMonitor`
|===

== Configuration and use

.Monitor-specific parameters for the NrpeMonitor
[options="header"]
[cols="1,3,2"]
|===
| Parameter
| Description
| Default

3+|*Required*

| command
| The \{check_name} of the command configured as `command[\{check_name}]="/path/to/plugin/check-script`
| empty

3+|*Optional*

| retry
| Number of retries before the service is marked as down.
| 0

| port
| Port to access NRPE on the remote server.
| 5666

| padding
| Padding for sending the command to the NRPE agent.
| 2

| usessl
| Enable encryption of network communication.
NRPE uses SSL with anonymous DH and the following cipher suite: TLS_DH_anon_WITH_AES_128_CBC_SHA
| true
|===

This monitor implements the <<reference:service-assurance/introduction.adoc#ref-service-assurance-monitors-common-parameters, Common Configuration Parameters>>.

== Example: Using check_apt with NRPE

This example shows how to configure the NrpeMonitor running the `check_apt` command on a configured NRPE.

Note that you must include the `monitor` section in your definition.

.Configuration of the NRPE check command on the agent in 'nrpe.cfg'
[source,bash]
----
command[check_apt]=/usr/lib/nagios/plugins/check_apt
----

.Configuration to test the NRPE plugin with the NrpeMonitor
[source, xml]
----
<service name="NRPE-Check-APT" interval="300000" user-defined="false" status="on">
  <parameter key="retry" value="3" />
  <parameter key="timeout" value="3000" />
  <parameter key="port" value="5666" />
  <parameter key="command" value="check_apt" />
  <parameter key="padding" value="2" />
</service>

<monitor service="NRPE-Check-APT" class-name="org.opennms.netmgt.poller.monitors.NrpeMonitor" />
----