How to get performance data out of a single check command (a script) that returns only 1 value in nagios?

I have this probe.sh script, which checks for temperature of a probe, the result is a simple number, which is the temperature in Celsius. My goal is to make centreon draw graphs from this number, but it returns nothing but that number.  To draw graphs, nagios needs performance data, which involves a lot of other values to be returned from the script (command). So basically I'm asking for someone to write the rest of the script (which is a huge part really), a person who understands bash scripting and nagios. I'm not in a hurry, I just can't seem to do it.

Bellow is the command example, plus another command that returns pefdata (check_centreon_ping). If you need the contents of tp_read.pl, I'll add them, but they're irrelevant in my opinion, awk only filters the number after probe.sh, which is the probe identifier and which is the useless part of the output from that check. I can in desperation send the IP address and both scripts so someone could check if it's working as he tests it.

I know it's a serious task so I'm really grateful to anyone that decides to try this. Thank you!
ngs:/usr/local/nagios/libexec# ./probe.sh 0.10132c65010800ec
21.0
ngs:/usr/local/nagios/libexec# cat probe.sh
#!/bin/bash
/usr/local/nagios/libexec/tp_read.pl d -f=10 -p=**.***.***.*** -a=$1|awk -F = '{print $2}'

ngs:/usr/local/nagios/libexec# ./check_centreon_ping **.***.***.***
GPING OK - rtt min/avg/max/mdev = 6.095/6.095/6.095/0.000 ms|time=6.095ms;20;40;; ok=1

Open in new window

zelia5Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
You actually have two values, the time the check was done and the temperature.  What other value are you looking for?
0
zelia5Author Commented:

Thank You for Your interest, I'm sorry for the late reply, maybe this link can help you:
http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201
0
zelia5Author Commented:
I got it, it was just a matter of editing the output so nagios can understand it as performance data

#!/bin/bash

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4

declare -rx SCRIPT=${0##*/}
declare -rx CMD_AWK="/bin/awk"
declare  -rx CMD_CAT="/bin/cat"
declare  -rx CMD_FREE="/usr/bin/free"
declare  -rx CMD_GREP="/bin/grep"


TEMP=$(/usr/local/nagios/libexec/tp_read.pl d -f=10 -p=**.***.***.*** -a=$1|awk -F = '{print $2}')

CRITICAL=35
WARN=33
if [ $TEMP -lt $CRITICAL ]; then
        echo "Temperature OK,Temperature Level: $TEMP|Temperature_level=$TEMP"
        exit $STATE_OK
else
        echo "High Temperature detected on Rack xx|$TEMP degrees"
        echo $STATE_CRITICAL

fi

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.