Problems using check_nrpe

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Problems using check_nrpe

Post by mguthrie »

OH, I got it now. You have a '|' in your plugin output. Nagios interprets interprets plugin output this way:

<output message with some sort of exit code (0-3)> | <performance data for graphing>

The exit code from the check script must exit with a numeric value (0-3) in order for Nagios to read it correctly. In the code it will look something like :

Code: Select all

exit(0)   //if state is OK
exit(1)  //if state is warning
exit(2)  //if state is critical
exit(3)  //if state is unknown
Nagios is interpreting the check as "OK" because it's looking for that return code, but if it gets something else it shows up as FALSE (which is also 0) in most programming languages. So even though you're getting the text output the way you want it, Nagios is not finding the exit code.

Are you intending for the following data to be graphed?
'aw-test.txt'=1;0;1;
If not, you need to remove the '|' as part of your plugin output.

Does that make sense?
jsherrod
Posts: 13
Joined: Fri Nov 19, 2010 9:18 am

Re: Problems using check_nrpe

Post by jsherrod »

I'm not worried about the service having a graph.

The check returns OK but it's actually in a critical state. And the service state is saying "no files found". That's the problem. The same exact command works fine from the command line. See output from being of post.


This is the Service State Information:

Service State Information
Current Status: OK (for 0d 2h 15m 11s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
Current Attempt: 1/5 (HARD state)
Last Check Time: 12-09-2010 12:17:05
Check Type: ACTIVE
Check Latency / Duration: 0.198 / 0.300 seconds
Next Scheduled Check: 12-09-2010 12:22:05
Last State Change: 12-09-2010 10:06:05
Last Notification: N/A (notification 0)
Is This Service Flapping? NO (0.00% state change)
In Scheduled Downtime? NO
Last Update: 12-09-2010 12:21:16 ( 0d 0h 0m 0s ago)
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Problems using check_nrpe

Post by mguthrie »

Is the CheckFile2 a script that you guys or using, or is it a community check_plugin? If the script is hitting an error when it's not supposed to it will exit with a "0" return value. In most programming languages, "false" and "0" and "the program just crashed" can be interpreted the same depending on how it is written.