Own made plugin check_temp


#1

Hello.

We’ve made a own check command in the /usr/local/nagios/libexec/ library. The command is specified in the command.cfg, and the hostgroup in remotehost.cfg.

We have a temperature sensor in our serverroom, en we would like to see the degrees back in Nagios.
In the check_temp command we capture the temp from a simple website, and put it in variable $temp. This variable $temp comes back in the status message we’ve configured, but Nagios displays the message without the variable $temp.

Is this a know problem in Nagios Core 3.2.0?

This is check_temp code:

[quote]#!/bin/bash

web=“IPADRESS OF WEBSITE”

temp=lynx --dump $web | grep -o 'Temp:*.*' | awk -v ORS="" '{print $2}'
wait
#echo $temp

wait

limit=21

#echo $temp

if ! echo “$temp $limit -p” | dc | grep > /dev/null ^-; then
message="CRITICAL: Current temp: $temp gr. Celcius. The temp is too high."
echo "${message} | Perfdata=${temp}"
exit 2
elif ! echo “$limit $temp2 -p” | dc | grep > /dev/null ^-; then
message="OK: Current temp: $temp gr. Celcius. The temp is ok."
echo "${message} | Perfdata=${temp}"
exit 0
else
echo "UNKNOWN: Something is wrong. serverroom temp might not be available."
exit 3
fi

[/quote]

The message shown under status information in Nagios is : OK: Current temp: gr. Celcius. The temp is ok.
So the variable $temp is not shown.

If we run the check_temp in command line the output is: OK: Current temp: 20 gr. Celcius. The temp is ok.

Could anyone please help :frowning:


#2

We replaced the lynx commando with a curl commando, and the problem is solved! 8)