[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hobbit temp.sh that uses lmsensors (submission)
- To: hobbit (at) hswn.dk
- Subject: Hobbit temp.sh that uses lmsensors (submission)
- From: Charles Jones <jonescr (at) cisco.com>
- Date: Fri, 25 Jan 2008 15:19:47 -0700
- Authentication-results: sj-dkim-1; header.From=jonescr (at) cisco.com; dkim=pass ( sig from cisco.com/sjdkim1004 verified; );
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; l=1175; t=1201299590; x=1202163590; c=relaxed/simple; s=sjdkim1004; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=jonescr (at) cisco.com; z=From:=20Charles=20Jones=20<jonescr (at) cisco.com> |Subject:=20Hobbit=20temp.sh=20that=20uses=20lmsensors=20(s ubmission) |Sender:=20; bh=ZYlxAQuJJw5UUW8cPFeyUKsrIUqc7v/L88zyRiQCWNg=; b=E9i6FNQGuPohkpFYNi6ob3a2wohkeZ1xSXNQLgJydCfJLxAJWOjX0E5Nz8 WzwNkeTvEn3ryR9DQd06Vuhy100dzDZYXEmasV0ndEpIuT/xmp88pDET/yca Wk5pB7evqN8ES4Yk+lE3vlQQz1IW9ZcjTd91XRmmfOHecCKfyP9Ko=;
- User-agent: Thunderbird 2.0.0.9 (X11/20071115)
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
"