Hobbit temp.sh that uses lmsensors (submission)

Charles Jones jonescr at cisco.com
Fri Jan 25 23:19:47 CET 2008


I dunno if I sent this before, I hacked up an ext script that would 
report the temperature to Hobbit. Folks here don't usually use Celcius 
so the script uses the -f option. For this to work you must have 
lm_sensors installed and configured (via sensors-detect).

-Charles

#!/bin/sh
# YELLOW and RED THRESHOLD VALUES for TEMPERATURE
YTMP=75
RTMP=79
#
SENSORS="/usr/bin/sensors -f"
COLOR=green
MSG=Error
#
# PARSE TEMPERATURE INFORMATION.
TMP=`${SENSORS}| ${GREP} -i temp|tail -1|cut -d"(" -f1|cut -d"°" -f1|cut 
-d"+" -f2|cut -d"." -f1`
    if [ ${TMP} -le ${YTMP} ];
    then
        COLOR=green
        MSG="The Temperature is currently ${TMP}F, which does not exceed 
the Warning level (${YTMP}F)"
    fi
    if [ ${TMP} -gt ${YTMP} ] && [ ${TMP} -lt ${RTMP} ];
    then
        COLOR=yellow
        MSG="The Temperature is currently ${TMP}F, which is exceeds the  
Warning level (${YTMP}F)"
    fi
    if [ ${TMP} -gt ${RTMP} ];
    then
        COLOR=red
        MSG="The Temperature is currently ${TMP}F, which exceeds the 
Panic level (${RTMP}F!)"
    fi

$BB $BBDISP "status $MACHINE.temp $COLOR `date`
$MSG
temp : $TMP
"




More information about the Xymon mailing list