[hobbit] Sending data from script to an rrd

Rob Munsch rmunsch at solutionsforprogress.com
Wed Oct 18 21:12:43 CEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ralph Mitchell wrote:
> On 10/18/06, Rob Munsch <rmunsch at solutionsforprogress.com> wrote:
>> > When you add the --extra-script option in the [rrdstatus] block,
>>
>> Well i'm stuck already.  What file is that block in?  I can't find it in
>> 'server.cfg nor 'graph.cfg...
> 
> It's in server/etc/hobbitlaunch.cfg

yeah found that with a grep rrdstatus, heh oops.

>> So something like
>>
>> echo "DS:cputemp:GAUGE:600:0:U"
>> echo "cputemp.rrd"
>>
>> probably isn't far off after all?
> 
> That should do it, yes.  That's the format for the RRD creation, and
> the name to create.  If you just want to push out one value, you'd
> follow that with:
> 
>   echo "$temp"

I seem to still be doing something wrong...

> I don't think hobbit_rrd will recreate the rrd if it already exists,
> so you'd have to delete it sometime to get it rebuilt with the extra
> variables.  Wave bye-bye to your old data...

"Sir, I have no data."

Ok, so i did this

[cputemp]
        TITLE CPU Temp
        YAXIS Degrees Fahrenheit
        DEF:avg=cputemp.rrd:cputemp:AVERAGE
        AREA:cputemp#00CC00:CPU Temp Average
        -u 1.0
        GPRINT:cputemp:LAST: \: %5.11f (cur)
        GPRINT:cputemp:MAX: \: %5.1lf (max)
        GPRINT:cputemp:MIN: \: %5.1lf (min)
        GPRINT:cputemp:AVERAGE: \: %5.1lf (avg)\n

and this

GRAPHS="la,disk,inode,qtree,memory,users,cputemp,.....8<...

as well, on the server.
but what i get is a text link called

Status unchanged in 1 hours, 41 minutes
Status message received from 10.10.10.12
hobbit graph cputemp

that leads to nothing.  Not even a "nan" graph :P

I think maybe by echo is in the wrong place...?  Should it be before or
after the $BB msg command?  Does it matter?

hobbit at currant:~/client/ext$ cat cputemp.sh
#!/bin/sh

umask 133

COLUMN=cputemp
COLOR=green
MSG="Current CPU Temperature: "
host=`hostname`

ipmitool sensor | grep Temp | awk -F\| '{print $1,$2,$3,$4}' >
$BBTMP/cputemp.$host

cpu_temp=`tail -n 4 $BBTMP/cputemp.$host |head -n 1 | awk '{print $2}'
|sed 's/\..*//g'`
# Converting to Fahrenheit.
temp=$((${cpu_temp}*9/5+32))

# Ok, we have the temp in degrees as an integer.
# Now to see if it's Bad, or even Very Bad.

if $temp > 130
then
        COLOR=red
        MSG="${MSG} $temp degrees Fahrenheit!

        Hothothot!
        "
else
        MSG="${MSG} $temp Degrees Fahrenheit

        Chillin' like a Villain.
        "
fi

echo "DS:cputemp:GAUGE:600:0:U"
echo "cputemp.rrd"
echo "$temp"

# Get this to the hobbit server
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`

${MSG}
"

exit 0


- --
Rob Munsch
Solutions For Progress IT
www.solutionsforprogress.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFNnyrBvBcJFK6xYURAt3KAJ9TmnWy1GLkx/yfDFB4G4QBEtPVCQCfYp1l
Rt0EeHF8jWGfJnjxzUtX/ss=
=xFd4
-----END PGP SIGNATURE-----



More information about the Xymon mailing list