Xymon Mailing List Archive search

Sending data from script to an rrd

list Rob Munsch
Wed, 18 Oct 2006 15:34:40 -0400
Message-Id: <user-712ea3322399@xymon.invalid>

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

Hubbard, Greg L wrote:
Rob,

You are trying to combine two scripts into one.  Read the FAQ.
I don't faintly understand what you mean.  I have one script.

And as stated, i have both read the FAQ and the manpages and still not
gotten it to click in my head; hence, i am here.
GLH

-----Original Message-----
From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] 
Sent: Wednesday, October 18, 2006 2:13 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Sending data from script to an rrd

Ralph Mitchell wrote:
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> 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

iD8DBQFFNoHPBvBcJFK6xYURAnmeAJ99en7G3Pb0BqRK1WJMtJYmK6fpVACfbajb
XocUwudUBdzgQLeAeQITUL0=
=4a/u
-----END PGP SIGNATURE-----