<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I figured I would share the script and setup that I am now using,  Note
that the script is for use with lm_sensors on linux machines, and
tailored for my particular setup (different servers have different
sensors and thus the temperature parsing section may have to be
changed).<br>
<br>
Here is the script itself:<br>
<tt>#!/bin/sh<br>
<br>
# THRESHOLD VALUES FOR TEMPERATURE <br>
YTMP=72<br>
RTMP=80<br>
#<br>
SENSORS="/usr/bin/sensors -f"<br>
STMP=${BBTMP}/SENSE.$$<br>
COLOR=green<br>
MSG=default<br>
#<br>
${SENSORS} > ${STMP}<br>
# PARSE TEMPERATURE INFORMATION.<br>
TMP=`${GREP} -i temp ${STMP}|cut -d"(" -f1|cut -d"�" -f1|cut -d"+"
-f2|cut -d"." -f1`<br>
    if [ ${TMP} -lt ${YTMP} ];<br>
    then<br>
        COLOR=green<br>
        MSG="The Temperature is currently ${TMP}F, which does not
exceed the Warning level (${YTMP}F)"<br>
    fi<br>
    if [ ${TMP} -gt ${YTMP} ] && [ ${TMP} -lt ${RTMP} ];<br>
    then<br>
        COLOR=yellow<br>
        MSG="The Temperature is currently ${TMP}F, which is exceeds
the  Warning level (${YTMP}F)"<br>
    fi<br>
    if [ ${TMP} -gt ${RTMP} ]; <br>
    then<br>
        COLOR=red<br>
        MSG="The Temperature is currently ${TMP}F, which exceeds the
Panic level (${RTMP}F!)"<br>
    fi<br>
rm ${STMP}<br>
<br>
$BB $BBDISP "status $MACHINE.temp $COLOR `date` <br>
$MSG<br>
temp : $TMP<br>
"</tt><br>
<br>
The script is launched via this addition to clientlaunch.cfg on the
remote machine:<br>
<tt>[temp]<br>
        ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg<br>
        CMD $HOBBITCLIENTHOME/ext/temp.sh<br>
        INTERVAL 5m</tt><br>
<br>
On the server, here is the addition to hobbitgraph.cfg:<br>
<tt>[temp]<br>
        TITLE Temperature<br>
        YAXIS Degrees Farenheit<br>
        DEF:t=temp.rrd:temp:AVERAGE<br>
        LINE2:t#@COLOR@:Ambient Temp<br>
        GPRINT:t:LAST: \: %5.1lf (cur)<br>
        GPRINT:t:MAX: \: %5.1lf (max)<br>
        GPRINT:t:MIN: \: %5.1lf (min)<br>
        GPRINT:t:AVERAGE: \: %5.1lf (avg)\n</tt><br>
<br>
Let's not forget the additions to hobbitserver.cfg:<br>
<tt>TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbit,hobbitd,files,procs=processes,ports,clock,lines<b>,temp=ncv</b>"<br>
GRAPHS="la,disk,inode,qtree,files,processes,memory,users,vmstat,iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbit,hobbitd,clock,lines<b>,temp</b>"<br>
<b>NCV_temp="temp:GAUGE"</b></tt><br>
<br>
I also put a custom rules in hobbit-alerts.cfg:<br>
<tt># Temp alerts<br>
HOST=myhost.mydomain.com SERVICE=temp<br>
        MAIL $SYSADMINS color=yellow REPEAT=60 RECOVERED NOTICE<br>
        MAIL $SYSADMINS,$SYSADMINS-PAGERS color=red RECOVERED NOTICE<br>
        MAIL $BOSS color=red DURATION>60 RECOVERED format=sms<br>
</tt><br>
-Charles<br>
<br>
<br>
<br>
Ralph Mitchell wrote:
<blockquote
 cite="mid:997a524e0707252120o5ef57cbdhb369288bc6640958@mail.gmail.com"
 type="cite">On 7/25/07, Charles Jones <a class="moz-txt-link-rfc2396E" href="mailto:jonescr@cisco.com"><jonescr@cisco.com></a> wrote:
  <br>
  <blockquote type="cite">I'm looking for a temperature script suitable
for linux machines (using
    <br>
lm_sensors). I found a couple on deadcat but none of them seemed to
work
    <br>
very well.  I hacked on one and got basic temperature monitoring
    <br>
working, but no graphs because the output is not in whatever format
    <br>
Hobbits do_temp rrd module is expecting.
    <br>
    <br>
Does anyone have an lm_sensors script that both alerts on temp
    <br>
thresholds and is compatible with Hobbits rrd graphing? I tried
seaching
    <br>
TheShire with no luck.
    <br>
  </blockquote>
  <br>
  <br>
Found this in old email (Dec 06):
  <br>
Jerry Yu <a class="moz-txt-link-rfc2396E" href="mailto:jjj863@gmail.com"><jjj863@gmail.com></a>     <br>
never mind, I found the answers in the source code,
  <br>
rrd/do_temperature.c. [[ All hail goes to Open Source & Henrik! ]]
  <br>
1. a lump-all status command will do. Format of the data portion is
  <br>
somewhat restrictive '&green BMCambient 17 62\n&yellow
BMCriserCard 32
  <br>
93'. It'd be nice to have such format documented elsewhere other than
  <br>
the source code.
  <br>
2. if  'temperature' is used as 'test name', nothing needs to be done.
  <br>
3. the check can be done locally on the client and the overall $status
  <br>
is reported by 'status server1.temperature $status'.
  <br>
  <br>
So, if the script you hacked up can be persuaded to send a status
  <br>
message that looks something like:
  <br>
  <br>
    $BB $BBDISP status "server,domain,com.temperature `date`
  <br>
       &<color>  <variable_name>
<temp_in_celsius>  <temp_in_fahrenheit>"
  <br>
  <br>
you could get graphs.  I'm away from my work machines right now, so
  <br>
the above may be a little lacking.
  <br>
  <br>
Alternatively, try the NCV option.  Once a status message is set up to
  <br>
be pushed through the ncv module, all you need in the status message
  <br>
is:
  <br>
  <br>
    <variable name> : <value>
  <br>
  <br>
Anything on the line before the colon becomes the variable name,
  <br>
anything after the colon is the value that gets stored.
  <br>
  <br>
Ralph Mitchell
  <br>
  <br>
To unsubscribe from the hobbit list, send an e-mail to
  <br>
<a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>
  <br>
</blockquote>
<br>
</body>
</html>