Strange NRPE issue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
lee
Posts: 1
Joined: Tue Feb 08, 2011 4:14 pm

Strange NRPE issue

Post by lee »

Hello All,

I am experiencing a very strange issue with nrpe...
This issue has two dimensions.

First, I wrote a perl script to parse Ambient Temperature from a command line utility for Dell servers. The script would execute with out problems on the host, however running the check over nrpe produced strange output.

On the host I would get:
Temp OK 68 F
or
Temp WARNING 80 F
etc..

Running the check over nrpe only returned:
Temp OK F

And no matter what I did the value never showed up and nagios would think it was OK. Even if I purposely set the threshold very low and the check would return CRITICAL or WARNING on the localhost.

To attempt to solve this I re-wrote the script in bash. Now I have a similar problem....

Here is the script:

Code: Select all

#!/bin/sh

TEMP_WARN=$1
TEMP_CRIT=$2

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2

# Get Temp
TEMP_C=$(ipmitool sdr type Temperature |grep 'Ambient Temp'|awk '{ print $10 }')

# Convert to F, make an integer
TEMP_F=$(perl -e "print int((9/5)*$TEMP_C+32)")

#echo "Temp: $TEMP_F F. WARN: $TEMP_WARN, CRIT: $TEMP_CRIT"

if [ $TEMP_F -gt $TEMP_CRIT ]
then
 echo "Temp CRITICAL $TEMP_F F"
 exit $STATE_CRITICAL

elif [ $TEMP_F -gt $TEMP_WARN ]
then
 echo "Temp WARNING $TEMP_F F"
 exit $STATE_WARNING

else
 echo "Temp OK $TEMP_F F"
 exit $STATE_OK
fi
Running the script on the host returns the expected results:
/usr/local/bin/plugins32/ipmi_temp.sh 80 90
Temp OK 66 F

However running over nrpe from the nagios server:
/usr/lib/nagios/plugins/check_nrpe -H somehost.somewhere.com -c check_temp
Temp OK 57 F

I have no idea where its getting 57 F from, and no matter what the output on the host is I get "Temp OK 57 F"

I am running nagios/nrpe 2.12 on CentOS.

nrpe config:
command[check_temp]=/usr/local/bin/plugins32/ipmi_temp.sh 80 90



Thanks! Any help is appreciated!
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Strange NRPE issue

Post by mguthrie »

Use an absolute path for all of your binarys (perl). It might be returning a false value for the temp when you run it remotely.
Locked