I recently had an issue with an external script within Nagios which used the check_npre command to run a number of performance tests from Apache JMeter.
On running the scheduled check for the first time, this would fail with the following:
CHECK_NRPE: Socket timeout after 30 seconds.
The initial service check exceeded the configured NRPE socket timeout value of 30 seconds to complete. In order to resolve this rather than increasing the value for all services using the check_npre command I created a copy of the existing command ‘check_nrpe’ and modified the timeout value.
In order to do this I performed the following:
1) Browse to Configure > Commands.
2) Select the command ‘check_nrpe’ and create a copy.
3) Rename the copy of the command created in Step 2, and modify the timeout value (-t) in the command line. The below example configures the timeout value to be 600 seconds.
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 600 -c $ARG1$ $ARG2$
4) Browse to the service which is failing due to the timeout value being exceeded (Configure > Services)
5 ) Change the check command for the service to be the command created in Step 2.