Xymon Mailing List Archive search

Sending data from script to an rrd

list Greg L Hubbard
Wed, 18 Oct 2006 15:43:40 -0500
Message-Id: <user-eb269062a7af@xymon.invalid>

A note about NCV -- this is Yet Another Way to snag numbers and put them
into graphs, but I never got it to work.  So I did it the hard way.
Others have gotten NCV to work.  The problem is that NCV instructions
are unnecessary if you write your own parser.

I agree that the documentation is not written as a tutorial, but more as
a dump of working code.

GLH 

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

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

Hubbard, Greg L wrote:
Rob,

You are trying to combine two scripts into one.  Read the FAQ.
The faq, of note, has some contradictions, while we're on the subject.
Frex:

"If you want the graph included with the other graphs on the trends
column, you must add it to the GRAPHS setting in the
~hobbit/server/etc/hobbitserver.cfg file.


	GRAPHS="la,disk,<... lots more ...>,bbproxy,hobbitd,slab"

Okay. Did that with cputemp.  Then at the bottom:

"Make sure you have ncv listed in the GRAPHS setting in
hobbitserver.cfg. (Don't ask why - just take my word that it must be
there)."

Huh?  Does this refer to TEST2RRD and is a typo?  Does it mean the
"extra setting" vaguely described as

- -----
So we add an extra setting to hobbitserver.cfg:

	NCV_slab="inodecache:GAUGE,dentrycache:GAUGE"
- -----

which i kept after the existing statements in the Graph section, for
lack of any more specific notes.

Or does it mean that "ncv" must now appear in GRAPHS= by itself, and
this is the first mention of it?

I have spent all day working with this.  Please don't respond to threads
with "read the FAQ" when i quite obviously stated i have done so, and
they are definitely not written for the novice in any event.  It means
either you have not read what I have written, or that you feel I am in
some way not worth your time.  This is very frustrating.

Thank you.

-----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

iD8DBQFFNocyBvBcJFK6xYURAm1xAJ0eMz7qu+x+i1UZOXH0365rY1DefgCfT5P0
bh0QNDTExMNmwD3tyNpOkZc=
=q/sU
-----END PGP SIGNATURE-----