[hobbit] Hobbit viewing temperature in Hobbit
Hi.
I professionally use digitemp to monitor various temperatures in all my server rooms and other. But if you use lmsensors, please read the script. As far as I can see, it is only for one sensor and one temperature. You may have to rewrite the script or even just write a new one.
If you wish to see what the script outputs, just comment the line 'rm $(STMP)' with a hash sign (#).
Then run the script and read the file that it outputs.
With regards,
Sigurður Guðbrandsson
Raförninn ehf.
Suðurhlíð 35
105 Reykjavik | Iceland
sigurdur at raforninn.is | www.raforninn.is
Office: +(354) 552 2070
Mobile: +(354) 867 3573
-----Original Message----- From: Maik Heinelt [mailto:maik at vegasystems.com] Sent: 10. október 2007 04:54 To: hobbit at hswn.dk Subject: [hobbit] Hobbit viewing temperature in Hobbit
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello,
Id like to view the temperature of my machines in Hobbit. I only found a temperature script on www.deadcat.net, but there wanst a manual how to use it.
I also found the following script, but it doesn`t work on my linux machines.
#!/bin/sh
THRESHOLD VALUES FOR TEMPERATURE
YTMP=72 RTMP=80
SENSORS="/usr/bin/sensors -f" STMP=${BBTMP}/SENSE.$$ COLOR=green MSG=default
${SENSORS} > ${STMP}
PARSE TEMPERATURE INFORMATION.
TMP=`${GREP} -i temp ${STMP}|cut -d"(" -f1|cut -d"?" -f1|cut -d"+"
-f2|cut -d"." -f1`
if [ ${TMP} -lt ${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
rm ${STMP}
$BB $BBDISP "status $MACHINE.temp $COLOR date $MSG temp : $TMP "
LM_sensors is installed and working well.
Can somebody give me an advise, please?
Maik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHDFr5r4r+EhimPOURAp6DAKDVMyyX1Nbf47G6+PkVI+lJV54JowCcDVdP XtuvQadl6KSlyMkqNeZ/91s= =1FAV -----END PGP SIGNATURE-----
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
I have been struggling with this as well. Basicly, you have make sure your output of the output script looks like
Device Temp(°C) Temp(°F)
[image: green] Cpu1 33 91 [image: green] Mainboard 35 95
I've ended up with the following, using lm_sensors input. #!/bin/sh
COLUMN=temperature # Name of the column TEST=temperature
echo " $BBTMP/$MACHINE.temperature.$$"
Do whatever you need to test for something
As an example, go red if /tmp/badstuff exists.
ENV_CELSIUS=$(sensors |grep 'CPU Temp'|awk '{print $3}'|sed -e 's/+//' -e
's/°C//' -e 's/..$//')
ENV_CELSIUSMAINB=$(sensors |grep 'M/B' |awk '{print $3}'|sed -e 's/+//' -e
's/°C//')
ENV_HIGHWARN=38
ENV_HIGHPANIC=42
ENV_CPU="Cpu1"
ENV_MAINB="Mainboard"
$AWK -v CELSIUS=$ENV_CELSIUS -v HIGHWARN=$ENV_HIGHWARN -v
HIGHPANIC=$ENV_HIGHPANIC -v CPU=$ENV_CPU
-v CELSIUSMAINB=$ENV_CELSIUSMAINB -v MAINB=$ENV_MAINB
'BEGIN {
print "Device Temp(°C) Temp(°F)";
print "------------------------------";
COLOR="green";
if (CELSIUS >= HIGHPANIC) {
COLOR="red";
printf("&red %-12s %3d
%3d\n",CPU,CELSIUS,CELSIUS*9/5+32);
printf("&green %-12s %3d
%3d\n",MAINB,CELSIUSMAINB,CELSIUSMAINB*9/5+32);
} else if (CELSIUS >= HIGHWARN) {
if (COLOR != "red")
COLOR = "yellow";
printf("&yellow %-12s %3d
%3d\n",CPU,CELSIUS,CELSIUS*9/5+32); printf("&green %-12s %3d %3d\n",MAINB,CELSIUSMAINB,CELSIUSMAINB*9/5+32); } else { printf("&green %-12s %3d %3d\n",CPU,CELSIUS,CELSIUS*9/5+32); printf("&green %-12s %3d %3d\n",MAINB,CELSIUSMAINB,CELSIUSMAINB*9/5+32); } } END { print "-------------------------------------------------"; if (COLOR == "green") { print "Status green: All devices look okay"; exit 0 } else if (COLOR == "yellow") { print "Status yellow: Some devices are nearing their operational limits"; exit 1 } else if (COLOR =="red") { print "Status red : SYSTEM NEAR THERMAL SHUTDOWN!!!"; exit 2 } else { print "Status purple : Unknown status"; exit -1 } }' > $BBTMP/$MACHINE.temperature.$$
COLOR=$GREP Status $BBTMP/$MACHINE.temperature.$$| $SED 's/Status //'|$SED 's/:.*$//'
#create log if NOT green
if [ $COLOR != "green" ]
then
TEMP=$GREP $ENV_CPU $BBTMP/$MACHINE.temperature.$$| awk '{print $3}'
echo "$COLOR : date '+%a %d %b %Y %H:%M:%S'
Temperature: $TEMP" >> $HOBBITCLIENTHOME/logs/temp_alerts.log
fi
DATA="Temperature status:
$CAT $BBTMP/$MACHINE.temperature.$$
Last 10 Alerts:
$TAIL $HOBBITCLIENTHOME/logs/temp_alerts.log
"
LINE="status $MACHINE.$TEST $COLOR date $DATA"
Clean up our mess.... $RM -f $BBTMP/$MACHINE.temperature.$$
Tell Hobbit about it
$BB $BBDISP "$LINE"
participants (2)
-
leen.smit@gmail.com
-
sigurdur@raforninn.is