NRPE - Packet Size Explained


Overview

This KB article discusses NRPE and the network packet size used in the different versions of the client and the check_nrpe plugin.

 

 

Nomenclature

The following explains the terms used in this document.

 

 

Before NRPE v3

NRPE v2.15 and earlier have had a fixed packet size of 1024 bytes (referred to as v2 packet). What this means is that any plugin executed by NRPE that had an output which exceeded 1024 bytes would be truncated past this. Apart from cutting off useful information, any performance data at the end of the output would also be missing / incomplete and cause irregularities in the performance data (gaps in graphs).

It has been possible in the past to modify the source code and increase this to a larger number. However you were required to do this on the Nagios core server (check_nrpe plugin) and all the clients, there was no easy way to implement this with minimal interruption.

NSClient++ also has this fixed packet size (referred to as payload length) which can be increased in the config file. However it required the same source code edit for the check_nrpe plugin on the Nagios server.

 

 

NRPE v3 Onwards

NRPE v3 has had major improvements to the packet size to resolve the limitations of previous versions. The packet size is now variable up to 64K (referred to as v3 packet).

Compatibility with previous versions of NRPE and NSClient++ were taken into account to ensure a smooth transition to the new version of the client and plugin. This allows you to migrate to NRPE v3 without any immediate changes required to the server or clients/agents. These compatibilities are described as follows.

 

NRPE v3 plugin -> NRPE v2 (and earlier) Client

The v3 of check_nrpe will contact the client trying to establish a v3 packet session. This will fail immediately and then check_nrpe will retry using a v2 packet session. The connection will then succeed allowing NRPE to operate as per normal. This backwards compatibility allows you to implement the updated plugin on your Nagios server and then transition the clients as required.

There will be some errors in the logs which is described in more detail in this KB article:

Documentation - v3 Compatibility With Previous Versions

Until you update the clients you will not be able to take advantage of the larger v3 packet size. Monitoring will function as normal.

 

NRPE v2 (and earlier) plugin -> NRPE v3 Client

The v2 of check_nrpe will contact the client trying to establish a v2 packet session (just like it always has).  The connection will succeed allowing NRPE to operate as per normal. This backwards compatibility allows you to update all of your clients before updating the plugin on your Nagios server.

Until you update the check_nrpe plugin you will not be able to take advantage of the larger v3 packet size. Monitoring will function as normal.

 

NRPE v3 plugin -> NRPE v3 Client

The v3 of check_nrpe will contact the client trying to establish a v3 packet session.  The connection will succeed allowing NRPE to operate as per normal along with the enhanced v3 packet size.

 

NRPE v3 plugin -> NSClient++

The v3 of check_nrpe will contact the client trying to establish a v3 packet session. This will fail immediately and then check_nrpe will retry using a v2 packet session. The connection will then succeed allowing NSClient++ to operate as per normal. This backwards compatibility allows you to implement the updated plugin on your Nagios server while ensuring NSClient++ continues to function normally.

Information on enabling NSClient++ to allow an increased packet size is covered in the next section.

 

 

Increasing NSClient++ Payload Length

To allow v3 of check_nrpe to communicate with NSClient++ using an increase packet size will require some planning. The changes to the NSClient++ config file are explained below, however once you make these changes you will also need to update the Nagios command and service definitions as the check_nrpe plugin requires additional command line arguments.

You will need to decide on the size of the packet you wish NRPE and NSClient++ to communicate with. This is a fixed size, which means regardless how much data needs to be transmitted, the entire size will be transmitted. With this in mind, you may only need a size around 8192 instead of a large value like 65536. The following example will use 8192.

 

NSClient++ Changes

On your Windows server open the C:\Program Files\NSClient++\nsclient.ini file in a text editor.

Add the following line to the [/settings/NRPE/server] section (add both lines if the section does not exist).

[/settings/NRPE/server]
payload length=8192

Save the file and restart the NSClient++ service.

Alternatively the following commands inside a command prompt will do these changes instead of editing the file manually:

cd "\Program Files\NSClient++\"
nscp settings --path /settings/NRPE/server --key "payload length" --set 8192
nscp service --restart

 

check_nrpe Plugin Syntax

You will need to update your Nagios command and service definitions to include -2 -P 8192 to allow the plugin and client to communicate.

/usr/local/nagios/libexec/check_nrpe -2 -P 8192 -H 10.25.14.2

 

This is an example result from running the command:

I (0.5.0.22 2016-02-11) seem to be doing fine...

 

The following KB article explains how you can define these arguments in a config file:

Documentation - v3 check_nrpe Config File

 

 

Final Thoughts

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

http://support.nagios.com/forum/



Article ID: 518
Created On: Thu, Jun 30, 2016 at 12:14 AM
Last Updated On: Tue, Jul 12, 2016 at 5:11 PM
Authored by: tlea

Online URL: https://support.nagios.com/kb/article/nrpe-packet-size-explained-518.html