rrdtool from private scripts
list Rob Munsch
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 user-ab6075fed63c@xymon.invalid wrote:
Hi, I wrote a script to get alert about CPU loads on a windows server using SNMP (no I don't want to / can't install the hobbit client on the server ;). The status is returned OK (green before 50%, orange from 50 to 75 and red over 75). The thing is, there is no graph done (yet).
Now that i'm approaching "working" with my ipmitool script, i'd like to remember how to do this too :D - -- 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 iD8DBQFFNlZxBvBcJFK6xYURArSbAJwMk6ZteKUTGA/CTXTLP4Cx8O+UQQCeMdsU nW5dJlJX51FUAFXdrJukqbs= =i9+u -----END PGP SIGNATURE-----
list Ralph Mitchell
▸
On 10/18/06, user-ab6075fed63c@xymon.invalid <user-ab6075fed63c@xymon.invalid> wrote:
Hi, I wrote a script to get alert about CPU loads on a windows server using SNMP (no I don't want to / can't install the hobbit client on the server ;). The status is returned OK (green before 50%, orange from 50 to 75 and red over 75). The thing is, there is no graph done (yet).
I would like a graph that would show the load average variation.
(how) can the script be used to fill a RRD database ?
Should the load average value be returned in a special variable ?
I'm doing something similar - SNMP queries against a Compaq system to produce a report like this: CPU 1 min 5 min 30 min 60min &green 0 14% 9% 9% 9% &green 1 11% 7% 9% 9% I changed the [rrdstatus] entry in server/etc/hobbitlaunch.cfg to include the --extra-script & --extra-tests entries as described in the hobbit_rrd man page. If it gets through the mail system, my collection script is attached. It's not rocket science, but it seems to get the job done. That pokes the data into an RRD, then it's just a question of setting up the graph config to show what you want to see. Ralph Mitchell
Attachments (1)
list Ralph Mitchell
▸
On 10/18/06, Ralph Mitchell <user-00a5e44c48c0@xymon.invalid> wrote:
On 10/18/06, user-ab6075fed63c@xymon.invalid <user-ab6075fed63c@xymon.invalid> wrote:Hi, I wrote a script to get alert about CPU loads on a windows server using SNMP (no I don't want to / can't install the hobbit client on the server ;). The status is returned OK (green before 50%, orange from 50 to 75 and red over 75). The thing is, there is no graph done (yet). I would like a graph that would show the load average variation. (how) can the script be used to fill a RRD database ? Should the load average value be returned in a special variable ?I'm doing something similar - SNMP queries against a Compaq system to produce a report like this: CPU 1 min 5 min 30 min 60min &green 0 14% 9% 9% 9% &green 1 11% 7% 9% 9% I changed the [rrdstatus] entry in server/etc/hobbitlaunch.cfg to include the --extra-script & --extra-tests entries as described in the hobbit_rrd man page. If it gets through the mail system, my collection script is attached. It's not rocket science, but it seems to get the job done. That pokes the data into an RRD, then it's just a question of setting up the graph config to show what you want to see. Ralph Mitchell
The script was blocked, so here it is:
Ralph Mitchell
#!/bin/sh
# Input parameters: Hostname, testname (column), and messagefile
#
# Messagefile contains this:
# Thu Jan 12 06:33:28 CST 2006 compaq_cpu
#
# This checkout shows CPU utilization as a percentage of the
# theoretical maximum over 1min, 5min, 30min & 60min periods.
#
#
#
# CPU 1 min 5 min 30 min 60min
# &green 0 7% 7% 6% 7%
# &green 1 7% 9% 8% 10%
#
#
TMPLOG="/tmp/$1.$2.out"
echo "$1, $2, $3" > $TMPLOG
cat $3 >> $TMPLOG
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
# Check the test name so that this script can service multiple
# data collection needs
if [ "$TESTNAME" = "cpqcpu" ]
then
# The RRD dataset definitions
echo "DS:1min:GAUGE:600:0:100"
echo "DS:5min:GAUGE:600:0:100"
echo "DS:30min:GAUGE:600:0:100"
echo "DS:60min:GAUGE:600:0:100"
# Analyze the message we got
cat $FNAME | while read line
do
if [ "$line" ]; then
line=`echo $line | sed -e 's/&//g' -e 's/%//g'`
set $line
case $1 in
green)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
yellow)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
red)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
*)
;;
esac
fi
done
fi
exit 0
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 user-ab6075fed63c@xymon.invalid wrote
(how) can the script be used to fill a RRD database?
Okay, i'm *way* behind you guys here. Where's the best starting point
for whipping up info from scratch?
Of note, this is what i wound up with. Yes, wince away at all those
pipes. It isn't zippy, but this Rube Goldbergesque script does work.
Caveats: add hobbit to your ipmi users (ipmitool makes this easy), and
make sure it can read the /dev/ipmi0, or you're going to feel silly (i
made an ipmi group and a udev permission rule to keep the device in it).
Any advice on the shortening the awksed acrobatics below would be
appreciated. The problem is that my raw output does NOT include "CPU"
or similar.. just "temp." Looking it up, line 1 is the external CPU
temp and line 2 is internal... but it comes out like this:
- -----
hobbit at currant:~$ ipmitool sensor
Temp | 31.000 | degrees C | ok | na | 5.000
| 10.000 | 85.000 | 90.000 | na
Temp | 38.000 | degrees C | ok | na | 5.000
| 10.000 | 85.000 | 90.000 | na
Planar Temp | 28.000 | degrees C | ok | na | 5.000
| 10.000 | 70.000 | 75.000 | na
VRD 0 Temp | 22.000 | degrees C | ok | na | 5.000
| 10.000 | 65.000 | 70.000 | na
VRD 1 Temp | 24.000 | degrees C | ok | na | 5.000
| 10.000 | 65.000 | 70.000 | na
- -----
"Temp" indeed! You have to "just know" what the first two lines are.
This is the start of my using this expensive BMC :), i plan on adding
everything Systems wants to see such as fan speed, general case temp,
RAID assertions and other joys. For now, getting and graphing CPU core
temp is my practice target. here's the script:
- -----
#!/bin/sh
umask 133
COLUMN=temp
COLOR=green
MSG="Current Temp"
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 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
# 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
iD8DBQFFNmG9BvBcJFK6xYURAoSoAJ9wQS6sFNM5/Q+DFZi27AvzSYTA5gCdGntj
gk6ZqNKnmGE2tR8bmS+MpeE=
=jO7X
-----END PGP SIGNATURE-----
list Joel Carnat
▸
Hi, I wrote a script to get alert about CPU loads on a windows server using SNMP (no I don't want to / can't install the hobbit client on the server ;). The status is returned OK (green before 50%, orange from 50 to 75 and red over 75). The thing is, there is no graph done (yet). I would like a graph that would show the load average variation. (how) can the script be used to fill a RRD database ? Should the load average value be returned in a special variable ?
Thanks for help,
Jo
list Ralph Mitchell
▸
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:
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'`
Is there a compelling reason not to fold the above into one line:
temp=`ipmitool sensor | tail -n 4 | head -n 1 | awk '{ print $3 }'`
▸
# Ok, we have the temp in degrees as an integer. # Now to see if it's Very Bad. if temp > 130 then
Does this bit work?? I get:
./ipmi.sh: line 22: temp: command not found
and an empty file called '130'. This works for me:
if [ $temp -gt 130 ]
then
The simplest way to graph it would be to have the message read something like:
cpu temp : $temp
then follow the instructions in the "Custom Graphs" entry from the
Help dropdown. You already have the first part - collecting the data.
If you use NCV, the above line would go into the RRD as cputemp,
because it takes everything before the colon and strips out spaces to
make the name, then takes the rest of the line as the number. That
probably a gross over-simplification... :)
Ralph
list Ralph Mitchell
▸
On 10/18/06, Ralph Mitchell <user-00a5e44c48c0@xymon.invalid> wrote:
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote: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'`Is there a compelling reason not to fold the above into one line: temp=`ipmitool sensor | tail -n 4 | head -n 1 | awk '{ print $3 }'`
Wups, my bad... Make that:
cpu_temp=`ipmitool sensor | tail -n 4 | head -n 1 | awk '{ print
$3 }' | sed -e 's/\..*//'`
Ralph
list Rob Munsch
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Okay, I have made the changes needed to *show* the graph, and i have my script. What i can't figure out is how to get the data from this client script onto the server, in data/rrd/testname, so it can be read. I've gone over the manpages and i'm still confused, sorry. Do i need to call another channel with the --extra-tests option? Is it in a config file somewhere? The sample script of "weather in Copenhagen" is a little opaque, it just shows a bunch of echoes but not their context. Is THAT script called by another within hobbit? Lastly is there a howto somewhere for exporting one's custom script data to RRD? TIA,
▸
- -- 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
iD8DBQFFNm6gBvBcJFK6xYURAhIUAKCDQrXdO2M3AeJ49Kyc3yXe0+6HfACfT1tx
uSo+W+hmwSM+AapWUMsJzCg=
=8Pr5
-----END PGP SIGNATURE-----
list Ralph Mitchell
▸
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:
I've gone over the manpages and i'm still confused, sorry. Do i need to call another channel with the --extra-tests option? Is it in a config file somewhere? The sample script of "weather in Copenhagen" is a little opaque, it just shows a bunch of echoes but not their context. Is THAT script called by another within hobbit? Lastly is there a howto somewhere for exporting one's custom script data to RRD?
When you add the --extra-script option in the [rrdstatus] block, what you're doing is handing the hobbit_rrd program another way to process information. Your script is fired up with the hostname, column name and the name of a file containing the log message, all on the command line. The hobbit_rrd then watches the script's standard output for dataset definitions (in case the RRD doesn't exist yet), then a number of colon-separated values to stuff into the RRD. hobbit_rrd takes care of the RRD creation and stuffing, you just need to echo out the correct format. It took me several iterations to get this straight... :) Ralph
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ralph Mitchell wrote:
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:I've gone over the manpages and i'm still confused, sorry. Do i need to call another channel with the --extra-tests option? Is it in a config file somewhere? The sample script of "weather in Copenhagen" is a little opaque, it just shows a bunch of echoes but not their context. Is THAT script called by another within hobbit? Lastly is there a howto somewhere for exporting one's custom script data to RRD?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...
▸
hobbit_rrd takes care of the RRD creation and stuffing, you just need to echo out the correct format.
So something like echo "DS:cputemp:GAUGE:600:0:U" echo "cputemp.rrd" probably isn't far off after all?
It took me several iterations to get this straight... :)
I bet i beat you! :D
Ralph
▸
- -- 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
iD8DBQFFNnaKBvBcJFK6xYURApsoAJwIKXUJGbo5anfA1yGRedsQQ2h36ACeLL0K
1NBZFAPuTCzlw0y51dblKlY=
=wl4p
-----END PGP SIGNATURE-----
list Ralph Mitchell
▸
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
▸
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"
▸
It took me several iterations to get this straight... :)I bet i beat you! :D
Ahh, if this wasn't a family channel... :)
Note that if you want to push several different columns through this
script, you'll need something that distinguishes between them, then
echo out appropriate RRD names/data. The hobbitd_rrd program only
runs *one* extra-script to deal with any results you send it...
So, if you're planning on several columns - cputemp, planartemp,
vrd0temp, etc, you'd need to allow for that in the script:
if [ "$2" = "cputemp"}; then
...
elif [ "$2" = "planartemp" ]; then
...
elif [ "$2" = "vrd0temp" ]; then
...
fi
On the other hand, if you're planning on pushing out all that stuff in
the same status message, you probably should go ahead and add the
extra RRD creation rows right away, and simply echo out zeroes for the
values until you figure out how to extract them:
echo "DS:cputemp:GAUGE:600:0:U"
echo "DS:planartemp:GAUGE:600:0:U"
echo "DS:vrd0temp:GAUGE:600:0:U"
echo "cputemp.rrd"
echo "$temp:0:0"
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...
Ralph
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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
iD8DBQFFNnyrBvBcJFK6xYURAt3KAJ9TmnWy1GLkx/yfDFB4G4QBEtPVCQCfYp1l
Rt0EeHF8jWGfJnjxzUtX/ss=
=xFd4
-----END PGP SIGNATURE-----
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Rob Munsch wrote:
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.cfgyeah 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...
yeah, i'm kind of an idiot: /local/hobbit/client/ext/cputemp.sh: line 25: 100: command not found DS:cputemp:GAUGE:600:0:U cputemp.rrd 100 /local/hobbit/client/ext/cputemp.sh: line 25: 100: command not found DS:cputemp:GAUGE:600:0:U cputemp.rrd 100 On the client my script is happily shouting this out to stdout. Where do i include these "echo" lines to get them properly noted by the server's rrdtool? I can see that no cputemp.rrd exists on the server. It's not getting there.
▸
- -- 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
iD8DBQFFNn3FBvBcJFK6xYURAitiAJ9r6yMc6JTVvCHBvgVlq4/bWeQseACfdCiD
m3BEriuMmaDMZMGqxxhweeA=
=MT36
-----END PGP SIGNATURE-----
list Ralph Mitchell
▸
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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.cfgyeah 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
There should be *two* scripts... The data collecting script that produces the report and uses "$BB BBDISP....." to send the data to Hobbit, and a separate script that echoes out the RRD creation bits and pieces. The first one would be launched by hobbit or cron or some other means, and the second is executed by hobbit_rrd due to the --extra-script flag in '[rrdstatus]'. *That's* the one where the "echo $temp" goes... Ralph
list Greg L Hubbard
Rob, You are trying to combine two scripts into one. Read the FAQ. 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
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
iD8DBQFFNnyrBvBcJFK6xYURAt3KAJ9TmnWy1GLkx/yfDFB4G4QBEtPVCQCfYp1l
Rt0EeHF8jWGfJnjxzUtX/ss=
=xFd4
-----END PGP SIGNATURE-----
list Rob Munsch
▸
-----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 itin 'server.cfg nor 'graph.cfg...It's in server/etc/hobbitlaunch.cfgyeah 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-----
list Ralph Mitchell
▸
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:
-----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.
Yes, but there should be two scripts. Script #1: runs anywhere - could be on your Hobbit server, could be on one or more remote server(s) at any random location on the planet. It reads the sensors, extracts the relevant data, formats the message and sends it to the Hobbit server Script #2: is executed by hobbitd_rdd via the --extra-script option. This one extracts relevant information from the incoming status report and echoes out the RRD creation parameters, the RRD file name, and the data to stuff into the RRD. Hobbit_rrd reads that and does what's necessary to save the data in an RRD. Ralph Mitchell
list Rob Munsch
▸
-----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 itin 'server.cfg nor 'graph.cfg...It's in server/etc/hobbitlaunch.cfgyeah 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-----
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ralph Mitchell wrote:
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:-----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.Yes, but there should be two scripts. Script #1: runs anywhere - could be on your Hobbit server, could be on one or more remote server(s) at any random location on the planet. It reads the sensors, extracts the relevant data, formats the message and sends it to the Hobbit server Script #2: is executed by hobbitd_rdd via the --extra-script option. This one extracts relevant information from the incoming status report and echoes out the RRD creation parameters, the RRD file name, and the data to stuff into the RRD. Hobbit_rrd reads that and does what's necessary to save the data in an RRD.
This is no way clearly explained by the docs if you didn't already know it. it indicates that your One True Custom Script lives on your client in the case of a client-side script, and sends info to the server as it's called. It goes on to describe changes to be made to various .cfg files, which i *have made*, so this data gets processed. The docs indicate that --extra-script should have "=<myclientsidescriptname>" tacked on to it, which i have also done. if this is not the case, please enlighten, and when i am done with this i would happy to provide clarification to the documentation.
Ralph Mitchell
▸
- -- 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
iD8DBQFFNofpBvBcJFK6xYURAr+HAJsGoHHjZHEmJVUsg2HdoCZoTixl8gCghacd
mxRTo7hil30CyNhMFTOdi6Q=
=WGAS
-----END PGP SIGNATURE-----
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ralph Mitchell wrote:
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hubbard, Greg L wrote:
Script #2: is executed by hobbitd_rdd via the --extra-script option. This one extracts relevant information from the incoming status report and echoes out the RRD creation parameters, the RRD file name, and the data to stuff into the RRD. Hobbit_rrd reads that and does what's necessary to save the data in an RRD.
maybe i'm not being clear. It's been a long day... I understand that the goal is to get data to RRD in a format it likes with data and filenames it understands. That part is obvious. The concept is not the issue; i know i want to graph things! What is not obvious is where to warn hobbit that this info is coming and precisely how to send that info; "echo" clientside was, i thought, read by the client's hobbitd as in a wrapper, but i guess not..?
▸
- -- 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
iD8DBQFFNoh/BvBcJFK6xYURAsnbAJ4thkw0rNR4Jvn7WoeX3s5ujdenygCfcz0J
HwEES1jq8lQLA8s9YFD/04w=
=kA5p
-----END PGP SIGNATURE-----
list Greg L Hubbard
Rob, The problem is that this is scattered across several different places in the Hobbit architecture. 1. Detecting the numbers. In a client-side (or server-side, though more rare) script, you do whatever you need to do to get some numbers. You format these numbers and send them to Hobbit. All Hobbit is looking for is the header line where you give it a color. The rest is just text that Hobbit will faithfully store and repeat back to you as date under the column you have selected. Knowing that only the first line is important, then you can do WHATEVER you want to show your numbers. Knowing that you will be parsing this text when you receive it, it is very helpful to put the data in a format that is easy to recognize and parse later, but is still readable to the human eye. Another note -- you need to do all of this on new columns -- don't try to augment the existing Hobbit tests. To debug: simply eyeball the text that is listed as column detail for your test. If Hobbit is getting it, and assigning a color, then you are out of the gate. 2. On the Hobbit server, you write a custom parser script. This script is called with three parameters -- the column name (aka test name), the node name associated with the test, and a file name. What your script should do is branch appropriately according to the test name, and then read the file, parsing it as needed. The script can be written in any language (Perl comes to mind if you don't like shell). But keep in mind that there is ONLY ONE parsing script allowed, and it needs to be able to service all of your custom tests. When you find the numbers you want for your test, you simply write to STDOUT the sequence that Hobbit is looking for to put your data in RRDS. ANYTHING else that you want to say in your script needs to be directed to a log file, or some other place. You have to tell the Hobbit server to use your script -- this requires modification of the hobbitlaunch file to change the parameter list for the hobbit_rrd modules. Notice that there are two of them -- one for data, and one for status. To debug: run your new test script by hand, supplying a bogus node name, the name of the real test, and the name of a file. I found it helpful to snag all of the test from the column detail and save it in a file, and then use that file as the file parameter. All you should see come out of your script is the RRD language -- first the DS statements, then the file name, and finally the data record. You can write it all to one RRD, or to several, depending on what you write out. 3. Now that RRD's are being created, you have to go and create graph definitions in hobbit-graph.cfg and you have to tell Hobbit about them so you can see them. You can choose from the wealth that is already there to get examples or "borrow" code. You will need to consult the RRDTool documentation to understand these graph definitions, because Hobbit graph is simply passing these definitions through to RRDTool for graphing. Now you need to update the Hobbit server configuration to include your graphs in both lists -- TRENDS and TEST2RRD. I could not keep things straight, so I ended up calling my graph definitions by the same name as my tests. So for test "foo" I create a graph definition "foo" instead of "bar". To debug: First, are the RRD entries being created? You should see them in the data directory underneath the name of the host where the client-side test is being run. Next, is there data being written to the RRD? You can dump the contents with RRDTool, but I forget the syntax. All you are looking for is that your data is ending up in the right place. Next, can you see your graphs? If you don't see a graph at all on your test page, then you probably have not identified it correctly to the Hobbit server in the hobbitconfig. If you see a broken link where you expect a graph, the problem is probably with your hobbitgraph.cfg file -- you made an error specifying the graph. I have created 7 or 8 custom tests with graphs and everything. The first one took several days, then I got a lot faster. I wish I had time to be more exhaustive in the instructions... Good luck!
▸
GLH
-----Original Message-----
From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid]
Sent: Wednesday, October 18, 2006 3:03 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Sending data from script to an rrd
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ralph Mitchell wrote:On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hubbard, Greg L wrote:
Script #2: is executed by hobbitd_rdd via the --extra-script option. This one extracts relevant information from the incoming status report
and echoes out the RRD creation parameters, the RRD file name, and the
data to stuff into the RRD. Hobbit_rrd reads that and does what's necessary to save the data in an RRD.
maybe i'm not being clear. It's been a long day... I understand that the goal is to get data to RRD in a format it likes with data and filenames it understands. That part is obvious. The concept is not the issue; i know i want to graph things! What is not obvious is where to warn hobbit that this info is coming and precisely how to send that info; "echo" clientside was, i thought, read by the client's hobbitd as in a wrapper, but i guess not..? - -- 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 iD8DBQFFNoh/BvBcJFK6xYURAsnbAJ4thkw0rNR4Jvn7WoeX3s5ujdenygCfcz0J HwEES1jq8lQLA8s9YFD/04w= =kA5p -----END PGP SIGNATURE-----
list Greg L Hubbard
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 itin 'server.cfg nor 'graph.cfg...It's in server/etc/hobbitlaunch.cfgyeah 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-----
list Rob Munsch
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hubbard, Greg L wrote:
Rob,
Hi greg. thanks for your patience.
▸
The problem is that this is scattered across several different places in the Hobbit architecture.
and how XD
▸
1. Detecting the numbers. In a client-side (or server-side, though more rare) script, you do whatever you need to do to get some numbers. You format these numbers and send them to Hobbit. All Hobbit is looking for is the header line where you give it a color. The rest is just text that Hobbit will faithfully store and repeat back to you as date under the column you have selected. Knowing that only the first line is important, then you can do WHATEVER you want to show your numbers. Knowing that you will be parsing this text when you receive it, it is very helpful to put the data in a format that is easy to recognize and parse later, but is still readable to the human eye.
This i got...
▸
Another note -- you need to do all of this on new columns -- don't try to augment the existing Hobbit tests.
...and did. And works well. I have a new CPUTemp column which shows the "CPU Temp: X degrees Fahrenheit." That was the easy part.
▸
2. On the Hobbit server, you write a custom parser script. This script is called with three parameters -- the column name (aka test name), the node name associated with the test, and a file name. What your script should do is branch appropriately according to the test name, and then read the file, parsing it as needed. The script can be written in any language (Perl comes to mind if you don't like shell). But keep in mind that there is ONLY ONE parsing script allowed, and it needs to be able to service all of your custom tests.
Oho. I have NO new script on the server. This part is what isn't documented well i think... is it a copy of my client script? Does it pull from the data that the client script is sending to the server? This what seems odd to me, the client is already sending the numbers i need to generate the color status. Why can't i use that??
▸
When you find the numbers you want for your test, you simply write to STDOUT the sequence that Hobbit is looking for to put your data in RRDS.
which is where those Echo commands came from, i see now.
▸
ANYTHING else that you want to say in your script needs to be directed to a log file, or some other place. You have to tell the Hobbit server to use your script -- this requires modification of the hobbitlaunch file to change the parameter list for the hobbit_rrd modules. Notice that there are two of them -- one for data, and one for status.
Did both of those. They just aren't uh running anything atm XD
▸
To debug: run your new test script by hand, supplying a bogus node name,
node name? :-/
the name of the real test, and the name of a file. I found it helpful to snag all of the test from the column detail and save it in a file, and then use that file as the file parameter. All you should see come out of your script is the RRD language -- first the DS statements, then the file name, and finally the data record. You can write it all to one RRD, or to several, depending on what you write out. 3. Now that RRD's are being created, you have to go and create graph definitions in hobbit-graph.cfg
This is also already done, since i thought i'd taken care of the rest.
▸
Now you need to update the Hobbit server configuration to include your graphs in both lists -- TRENDS and TEST2RRD. I could not keep things straight, so I ended up calling my graph definitions by the same name as my tests. So for test "foo" I create a graph definition "foo" instead of "bar".
Done also.
▸
To debug: First, are the RRD entries being created? You should see them in the data directory underneath the name of the host where the client-side test is being run. Next, is there data being written to the RRD? You can dump the contents with RRDTool, but I forget the syntax. All you are looking for is that your data is ending up in the right place. Next, can you see your graphs? If you don't see a graph at all on your test page, then you probably have not identified it correctly to the Hobbit server in the hobbitconfig. If you see a broken link where you expect a graph, the problem is probably with your hobbitgraph.cfg file -- you made an error specifying the graph.
argh. not done well, apparently... instead of what one would expect with correct definitions - a nan or blank graph - i have simply hobbit graph ncv:cputemp where the graph should be. In the absence of data, i should still have a blank graph, if i defined it correctly, right? So i messed that up.
▸
I have created 7 or 8 custom tests with graphs and everything. The first one took several days, then I got a lot faster.
I shall continue to slug away.
I wish I had time to be more exhaustive in the instructions...
Thank you for your time, this is starting to make sense to me now. I still do not quite get how the actual data gets to rrd. It seems to me that there is an isolated client script that sends data which determines the status color.. then a DIFFERENT server-side script is used to send the SAME DATA to RRD for graphing. ?!?! yesno? Why isn't there a way to use the existing data that the client's sending for graphing... for CPU, MEM, etc. isn't that already happening? or have i failed another concept here. On the server, i have made all config changes (despite the badly-crafted graph definition) but there is NO rrd data collected. I still don't get the client-server communication, i guess. Does anyone have a sample of a server-side RRD data collection script i could borrow, so i see how and where from it's grabbed? Thanks...
Good luck!
i don't need luck, i need to stop being so thick... :)
▸
GLH -----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Wednesday, October 18, 2006 3:03 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:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hubbard, Greg L wrote:Script #2: is executed by hobbitd_rdd via the --extra-script option. This one extracts relevant information from the incoming status reportand echoes out the RRD creation parameters, the RRD file name, and thedata to stuff into the RRD. Hobbit_rrd reads that and does what's necessary to save the data in an RRD.maybe i'm not being clear. It's been a long day... I understand that the goal is to get data to RRD in a format it likes with data and filenames it understands. That part is obvious. The concept is not the issue; i know i want to graph things! What is not obvious is where to warn hobbit that this info is coming and precisely how to send that info; "echo" clientside was, i thought, read by the client's hobbitd as in a wrapper, but i guess not..?
- -- 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
iD8DBQFFNpSUBvBcJFK6xYURArUzAJ9l4tNis+OwO0PnLrhADh1NUgaCIgCeMwC8
7yWkzgJoIXM+BvxSmoxDFQA=
=/rmJ
-----END PGP SIGNATURE-----
list Greg L Hubbard
Contact me offline and I fix you up.
▸
-----Original Message-----
From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Wednesday, October 18, 2006 3:55 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,
Hi greg. thanks for your patience.
The problem is that this is scattered across several different places in the Hobbit architecture.
and how XD
1. Detecting the numbers. In a client-side (or server-side, though more rare) script, you do whatever you need to do to get some numbers. You
format these numbers and send them to Hobbit. All Hobbit is looking for is the header line where you give it a color. The rest is just text that Hobbit will faithfully store and repeat back to you as date under the column you have selected. Knowing that only the first line is important, then you can do WHATEVER you want to show your numbers. Knowing that you will be parsing this text when you receive it, it is very helpful to put the data in a format that is easy to recognize and
parse later, but is still readable to the human eye.
This i got...
Another note -- you need to do all of this on new columns -- don't try
to augment the existing Hobbit tests.
...and did. And works well. I have a new CPUTemp column which shows the "CPU Temp: X degrees Fahrenheit." That was the easy part.
2. On the Hobbit server, you write a custom parser script. This script is called with three parameters -- the column name (aka test name), the node name associated with the test, and a file name. What your script should do is branch appropriately according to the test name, and then read the file, parsing it as needed. The script can be written in any language (Perl comes to mind if you don't like shell).
But keep in mind that there is ONLY ONE parsing script allowed, and it
needs to be able to service all of your custom tests.
Oho. I have NO new script on the server. This part is what isn't documented well i think... is it a copy of my client script? Does it pull from the data that the client script is sending to the server? This what seems odd to me, the client is already sending the numbers i need to generate the color status. Why can't i use that??
When you find the numbers you want for your test, you simply write to STDOUT the sequence that Hobbit is looking for to put your data in
RRDS. which is where those Echo commands came from, i see now.
ANYTHING else that you want to say in your script needs to be directed
to a log file, or some other place. You have to tell the Hobbit server to use your script -- this requires
modification of the hobbitlaunch file to change the parameter list for
the hobbit_rrd modules. Notice that there are two of them -- one for data, and one for status.
Did both of those. They just aren't uh running anything atm XD
To debug: run your new test script by hand, supplying a bogus node name,
node name? :-/
the name of the real test, and the name of a file. I found it helpful
to snag all of the test from the column detail and save it in a file, and then use that file as the file parameter. All you should see come
out of your script is the RRD language -- first the DS statements, then the file name, and finally the data record. You can write it all
to one RRD, or to several, depending on what you write out. 3. Now that RRD's are being created, you have to go and create graph definitions in hobbit-graph.cfg
This is also already done, since i thought i'd taken care of the rest.
Now you need to update the Hobbit server configuration to include your graphs in both lists -- TRENDS and TEST2RRD. I could not keep things straight, so I ended up calling my graph definitions by the same name as my tests. So for test "foo" I create a graph definition "foo" instead of "bar".
Done also.
To debug: First, are the RRD entries being created? You should see them in the data directory underneath the name of the host where the client-side test is being run. Next, is there data being written to the RRD? You can dump the contents with RRDTool, but I forget the syntax. All you are looking for is that your data is ending up in the right place. Next, can you see your graphs? If you don't see a graph at all on your test page, then you probably have not identified it correctly to the Hobbit server in the hobbitconfig. If you see a broken link where
you expect a graph, the problem is probably with your hobbitgraph.cfg file -- you made an error specifying the graph.
argh. not done well, apparently... instead of what one would expect with correct definitions - a nan or blank graph - i have simply hobbit graph ncv:cputemp where the graph should be. In the absence of data, i should still have a blank graph, if i defined it correctly, right? So i messed that up.
I have created 7 or 8 custom tests with graphs and everything. The first one took several days, then I got a lot faster.
I shall continue to slug away.
I wish I had time to be more exhaustive in the instructions...
Thank you for your time, this is starting to make sense to me now. I still do not quite get how the actual data gets to rrd. It seems to me that there is an isolated client script that sends data which determines the status color.. then a DIFFERENT server-side script is used to send the SAME DATA to RRD for graphing. ?!?! yesno? Why isn't there a way to use the existing data that the client's sending for graphing... for CPU, MEM, etc. isn't that already happening? or have i failed another concept here. On the server, i have made all config changes (despite the badly-crafted graph definition) but there is NO rrd data collected. I still don't get the client-server communication, i guess. Does anyone have a sample of a server-side RRD data collection script i could borrow, so i see how and where from it's grabbed? Thanks...
Good luck!
i don't need luck, i need to stop being so thick... :)
GLH -----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Wednesday, October 18, 2006 3:03 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:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hubbard, Greg L wrote:Script #2: is executed by hobbitd_rdd via the --extra-script option. This one extracts relevant information from the incoming status reportand echoes out the RRD creation parameters, the RRD file name, and thedata to stuff into the RRD. Hobbit_rrd reads that and does what's necessary to save the data in an RRD.maybe i'm not being clear. It's been a long day... I understand that the goal is to get data to RRD in a format it likes with data and filenames it understands. That part is obvious. The concept is not the issue; i know i want to graph things! What is not obvious is where to warn hobbit that this info is coming and precisely how to send that info; "echo" clientside was, i thought,
read by the client's hobbitd as in a wrapper, but i guess not..?
- -- 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 iD8DBQFFNpSUBvBcJFK6xYURArUzAJ9l4tNis+OwO0PnLrhADh1NUgaCIgCeMwC8 7yWkzgJoIXM+BvxSmoxDFQA= =/rmJ -----END PGP SIGNATURE-----
list Ralph Mitchell
▸
On 10/18/06, Rob Munsch <user-f39e4aae1456@xymon.invalid> wrote:
I still do not quite get how the actual data gets to rrd. It seems to me that there is an isolated client script that sends data which determines the status color.. then a DIFFERENT server-side script is used to send the SAME DATA to RRD for graphing. ?!?! yesno?
Yep.
▸
Why isn't there a way to use the existing data that the client's sending for graphing... for CPU, MEM, etc. isn't that already happening? or have i failed another concept here.
I think it is using the existing data... If the incoming report looks like it should be graphed (via TRENDS in bb-hosts, I think) it gets shunted to the hobbit_rrd program which does nothing if it finds none of the standard data (uptime, df, vmstat, etc). That's where the --extra-script script comes in. It breaks up the message into a form that hobbit_rrd can read. hobbit_rrd does something like fork-and-execute to run the extra script, and listens to the output channel from the script. It expects to see the RRD creation formula, the RRD name, then an RRD data string. hobbit_rrd then does whatever magic is required to stuff the data into the RRD file.
▸
On the server, i have made all config changes (despite the badly-crafted graph definition) but there is NO rrd data collected. I still don't get the client-server communication, i guess. Does anyone have a sample of a server-side RRD data collection script i could borrow, so i see how and where from it's grabbed? Thanks...
This is a hobbit_rrd script I use to pick up numbers from a cpu load report gathered from Compaq servers via an SNMP query. The line if [ "$TESTNAME" = "cpqcpu" ] allows the same script to process reports from multiple different column names. In this particular case, the column is 'cpqcpu'. Rlaph Mitchell
▸
#!/bin/sh
# Input parameters: Hostname, testname (column), and messagefile
#
# Messagefile contains this:
# Thu Jan 12 06:33:28 CST 2006 compaq_cpu
#
# This checkout shows CPU utilization as a percentage of the
# theoretical maximum over 1min, 5min, 30min & 60min periods.
#
# CPU 1 min 5 min 30 min 60min
# &green 0 7% 7% 6% 7%
# &green 1 7% 9% 8% 10%
#
#
TMPLOG="/tmp/$1.$2.out"
echo "$1, $2, $3" > $TMPLOG
cat $3 >> $TMPLOG
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
# Check the test name so that this script can service multiple
# data collection needs
if [ "$TESTNAME" = "cpqcpu" ]
then
# The RRD dataset definitions
echo "DS:1min:GAUGE:600:0:100"
echo "DS:5min:GAUGE:600:0:100"
echo "DS:30min:GAUGE:600:0:100"
echo "DS:60min:GAUGE:600:0:100"
# Analyze the message we got
cat $FNAME | while read line
do
if [ "$line" ]; then
line=`echo $line | sed -e 's/&//g' -e 's/%//g'`
set $line
case $1 in
green)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
yellow)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
red)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
*)
;;
esac
fi
done
fi
exit 0
list Henrik Størner
▸
On Wed, Oct 18, 2006 at 04:54:44PM -0400, Rob Munsch wrote:
I still do not quite get how the actual data gets to rrd. It seems to me that there is an isolated client script that sends data which determines the status color.. then a DIFFERENT server-side script is used to send the SAME DATA to RRD for graphing. ?!?! yesno? Why isn't there a way to use the existing data that the client's sending for graphing... for CPU, MEM, etc. isn't that already happening? or have i failed another concept here.
Writing clear documentation is difficult when you've designed all of this and know how everything fits together. So blame any missing or misleading docs on me :-) The first thing to get your head around is that Hobbit has a very clear separation between *collecting* data, *analyzing* data, and *presenting* data. Collecting data is done on the client; that's your script running ipmitool (or whatever you use to collect data) and sends it to the Hobbit server. When the Hobbit server - specifically, the "hobbitd" process that receives messages from the network - gets your data via a "status" message, it creates a column with the color your script decided upon. But it doesn't do any analysis of the data. Instead, it just shoves the raw message out through one or more of the Hobbit "channels", and lets the hobbitd_* worker modules do whatever they want to do with it. One of these worker modules is "hobbitd_rrd", which (as the name implies) handles updating of RRD files. It has to pick out the interesting numbers from the raw status message, and put them into an RRD file. hobbitd_rrd knows how to handle several different kinds of status messages (cpu, disk, memory, network response times ...), but for custom tests that you write yourself, you'll have to provide the code to pick out those numbers you want to put into the graph. So this is where the second script comes into play: This script is the one with the "echo" statements that you cannot quite figure out how should work. Basically, whenever hobbitd_rrd sees a status message which is one of those listed in the "--extra-tests" option, then it hands over the parsing of the status message data to a script you've written. This script must then return the data that should go into the RRD file. So this is the *analyzing* part, and it runs on the Hobbit server. It is done by your second script, which gets invoked by the hobbitd_rrd process. The final part is the *presentation* of the data. Hobbit knows how to present the status message itself, so the only thing that is missing is the graph that should be created based on the data in the RRD file. For this, you must first create a definition in hobbitgraph.cfg, describing what RRD file your graph uses, which datasets should go on the graph, whether they are lines or stacked areas etc. Next, you must associate the graph definition with the name of your status column; to do that, you add it to the TEST2RRD definition in hobbitserver.cfg. So if your column name is "ipmi" and the graph definition is also "ipmi", then you just add "ipmi" to the TEST2RRD setting. If the columnname and the graph definition differs, you add a COLUMNNAME=GRAPHNAME to TEST2RRD. Last, you must add the graph to the GRAPHS definition (yes, this is messy - I know) so it will show up also on the "trends" status. And here you use the filename of the RRD file (without ".rrd"). This is quite a bit of work you need to do. It's flexible, but it takes some time to get used to. There *is* a simpler mechanism called the "ncv" graphs, but this only works if the data in your status message is formatted as name-colon-value pairs which then go directly into an RRD file. I hope this helps. Regards, Henrik
list Henrik Størner
▸
On Wed, Oct 18, 2006 at 03:43:40PM -0500, Hubbard, Greg L wrote:
I agree that the documentation is not written as a tutorial, but more as a dump of working code.
If someone does write a tutorial, please send me a copy of it so I can include it with the Hobbit docs. As I said, it is really hard to forget everything you know and try and describe the proces to someone who has no prior knowledge about how it works. Regards, Henrik
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Henrik Stoerner wrote:
On Wed, Oct 18, 2006 at 03:43:40PM -0500, Hubbard, Greg L wrote:I agree that the documentation is not written as a tutorial, but more as a dump of working code.If someone does write a tutorial, please send me a copy of it so I can include it with the Hobbit docs. As I said, it is really hard to forget everything you know and try and describe the proces to someone who has no prior knowledge about how it works.
I've nothing to forget! ,-) As soon as I get this working i'll try to cobble it all into a working step-by-step. it might be a few days...
Regards, Henrik
▸
- -- 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
iD8DBQFFNp/gBvBcJFK6xYURAobNAJ9ml20FYgvyHv34t6pakHFUiGq3ogCeOFIo
+1w6wCxgwR4eTMHDnKjkmUA=
=7r1Q
-----END PGP SIGNATURE-----
list Thomas Kern
So for those of us on Non-Linux systems, the hobbit_rrd source code has all of the parsing definitions for the 'standard' tests. If I want to present 'standard' data to hobbit to be reported AND graphed, it must fit the parsing as defined in hobbit_rrd. If I want to present NEW data, I create a new column with a single extension script on the hobbit server to parse the new data delivered by the clients. /Thomas Kern /XXX-XXX-XXXX
▸
-----Original Message----- From: user-ce4a2c883f75@xymon.invalid [mailto:user-ce4a2c883f75@xymon.invalid] Sent: Wednesday, October 18, 2006 5:25 PM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrd
... Snipped ...
▸
When the Hobbit server - specifically, the "hobbitd" process that
receives messages from the network - gets your data via a "status"
message, it creates a column with the color your script decided upon.
But it doesn't do any analysis of the data. Instead, it just
shoves the
raw message out through one or more of the Hobbit "channels", and lets
the hobbitd_* worker modules do whatever they want to do with it.
One of these worker modules is "hobbitd_rrd", which (as the name
implies) handles updating of RRD files. It has to pick out the
interesting numbers from the raw status message, and put them into an
RRD file. hobbitd_rrd knows how to handle several different kinds of
status messages (cpu, disk, memory, network response times
...), but for
custom tests that you write yourself, you'll have to provide the code
to pick out those numbers you want to put into the graph. So this is
where the second script comes into play: This script is the
one with the
"echo" statements that you cannot quite figure out how should work.
Basically, whenever hobbitd_rrd sees a status message which is one of
those listed in the "--extra-tests" option, then it hands over the
parsing of the status message data to a script you've written. This
script must then return the data that should go into the RRD file.
list Rich Smrcina
Or use the NCV option which I use in a number of my custom tests for mainframe based systems.
▸
Kern, Thomas wrote:So for those of us on Non-Linux systems, the hobbit_rrd source code has all of the parsing definitions for the 'standard' tests. If I want to present 'standard' data to hobbit to be reported AND graphed, it must fit the parsing as defined in hobbit_rrd. If I want to present NEW data, I create a new column with a single extension script on the hobbit server to parse the new data delivered by the clients. /Thomas Kern /XXX-XXX-XXXX
--
Rich Smrcina VM Assist, Inc. Phone: XXX-XXX-XXXX Ans Service: XXX-XXX-XXXX user-61add9955ef9@xymon.invalid Catch the WAVV! http://www.wavv.org WAVV 2007 - Green Bay, WI - May 18-22, 2007
list Rob Munsch
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm askin' the wrong questions, i just realized. For custom test Foo which has Custom Script Foo.sh, which is a clientside script living in ~/client/ext; assuming all other .cfg acrobatics have been accomplished, where on the server am i going to find the raw $host.foo data/numbers for me to parse and pass on? I understand i can maybe copy someone else's macro for it, but i need to see what the raw data looks like so i know what i'm parsing :D.
▸
tia, - -- 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
iD8DBQFFN4yUBvBcJFK6xYURAs85AJoC6DdhUaYMNwch0IEi1YxjB/CM/ACfWlRq
dagJRNkDMOJlDjpaVnLEe/M=
=2g9/
-----END PGP SIGNATURE-----
list Greg L Hubbard
Hey Rob,
What is being passed is all the text you so carefully sent in your
client-side text. That is why it is important to "pitch" what you can
"catch."
When your custom, server-side, RRD-parsing script is called by the
Hobbit server, it will be called with three parameters. One of these
parameters is the fully qualified name of a file that you can open and
read. When your script exits, the Hobbit server will delete the file.
Look in the man pages for hobbitd_rrd, and look at the section called
"Custom RRD Data via Scripts"
GLH
Here is an example of this script, based on what I actually use (please
don't laugh at my code):
#!/bin/sh
#
# Custom script to parse non-standard files to get data for RRD datasets
# Designed to work with the open source "Hobbit Monitor" system
#
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
MYNAME="example-rrdparser"
DEBUG=1 # Set to 1 or uncomment to enable debugging output in
log
LOG="/opt/hobbit/server/log/$MYNAME.log"
NOW=`date '+%d-%h-%Y %H:%M:%S'`
# Each test name corresponds to the column name used by whoever posts
the
# data. At the very root level, this is specified when bb is called to
# send the message.
case $TESTNAME in
foo)
# Snag each foo data line
FOO_ALL=`grep "FOO_Events:" $FNAME | awk '{print $3}'`
if [ "$FOO_ALL" = "" ]
then
FOO_ALL="U"
fi
FOO_NOTIFY=`grep "FOO_Notifications:" $FNAME | awk
'{print $3}'`
if [ "$FOO_NOTIFY" = "" ]
then
FOO_NOTIFY="U"
fi
# Print out RRD Foo Dataset definitions
echo "DS:Events:GAUGE:600:0:U"
echo "DS:Notifications:GAUGE:600:0:U"
echo "foo.rrd"
echo "$FOO_ALL:$FOO_NOTIFY"
# Log good news
if [ $DEBUG ]; then
echo "[$NOW] $HOSTNAME:$TESTNAME -->
$FOO_ALL:$NCO_NOTIFY" >> $LOG
fi
;;
bar)
BAR_NODES=`grep "BAR-Nodes:" $FNAME | awk '{print $2}'`
if [ "$BAR_NODES" = "" ]
then
BAR_NODES="U"
fi
BAR_INTS=`grep "BAR-Interfaces:" $FNAME | awk '{print
$2}'`
if [ "$BAR_INTS" = "" ]
then
BAR_INTS="U"
fi
BAR_CONN=`grep "BAR-Connections:" $FNAME | awk '{print
$2}'`
if [ "$BAR_CONN" = "" ]
then
BAR_CONN="U"
fi
# Print BAR dataset definitions
echo "DS:Nodes:GAUGE:600:0:U"
echo "DS:Interfaces:GAUGE:600:0:U"
echo "DS:Connections:GAUGE:600:0:U"
echo "bar.rrd"
echo "$BAR_NODES:$BAR_INTS:$BAR_CONN"
# Log message
if [ $DEBUG ]; then
echo "[$NOW] $HOSTNAME:$TESTNAME -->
$BAR_NODES:$BAR_INTS:$BAR_CONN" >> $LOG
fi
;;
*)
echo "[$NOW] $HOSTNAME:$TESTNAME not implemented" >>
$LOG
;;
esac
#echo "[$NOW] $MYNAME completed." >> $LOG
exit 0
▸
-----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 9:33 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrd -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm askin' the wrong questions, i just realized. For custom test Foo which has Custom Script Foo.sh, which is a clientside script living in ~/client/ext; assuming all other .cfg acrobatics have been accomplished, where on the server am i going to find the raw $host.foo data/numbers for me to parse and pass on? I understand i can maybe copy someone else's macro for it, but i need to see what the raw data looks like so i know what i'm parsing :D. tia, - -- 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 iD8DBQFFN4yUBvBcJFK6xYURAs85AJoC6DdhUaYMNwch0IEi1YxjB/CM/ACfWlRq dagJRNkDMOJlDjpaVnLEe/M= =2g9/ -----END PGP SIGNATURE-----
list Rob Munsch
▸
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hubbard, Greg L wrote:
Hey Rob, What is being passed is all the text you so carefully sent in your client-side text. That is why it is important to "pitch" what you can "catch."
OH, so, you know how to craft your greps and awks based on the MSG you are sending from the client, is that it? I don't need to find and examine that passed data, because i can see its structure based on the $MSG i am sending at the end of the client script. Right?
(please don't laugh at my code):
shyeah, like i'm qualified to do so.
▸
case $TESTNAME in
foo)
# Snag each foo data line
FOO_ALL=`grep "FOO_Events:" $FNAME | awk '{print $3}'`this is where i was getting conf00zed. I was wondering what psychic powers you people were employing to know how to pick out what you wanted blindly :).
▸
# Print out RRD Foo Dataset definitions
echo "DS:Events:GAUGE:600:0:U"
echo "DS:Notifications:GAUGE:600:0:U"
echo "foo.rrd"
echo "$FOO_ALL:$FOO_NOTIFY"and this i'll just have to look up to make sure of. Thank you! I think it's starting to coalesce in my congealed brain...
▸
-----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 9:33 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrd I'm askin' the wrong questions, i just realized. For custom test Foo which has Custom Script Foo.sh, which is a clientside script living in ~/client/ext; assuming all other .cfg acrobatics have been accomplished, where on the server am i going to find the raw $host.foo data/numbers for me to parse and pass on? I understand i can maybe copy someone else's macro for it, but i need to see what the raw data looks like so i know what i'm parsing :D. tia,
- -- 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
iD8DBQFFN5ZnBvBcJFK6xYURAoAsAJ9RcsbnlCxv6hvxh9X3faafQ3pJmQCcDIKO
QrAIouK6rFoiE2bBA15wlU4=
=2WEU
-----END PGP SIGNATURE-----
list Greg L Hubbard
You got it, big man -- just remember to "pitch" what you know you can "catch". Since the catcher script KNOWS which test it is parsing, you can be as sloppy as you want.
▸
-----Original Message-----
From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid]
Sent: Thursday, October 19, 2006 10:15 AM
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:Hey Rob, What is being passed is all the text you so carefully sent in your client-side text. That is why it is important to "pitch" what you can
"catch."
OH, so, you know how to craft your greps and awks based on the MSG you are sending from the client, is that it? I don't need to find and examine that passed data, because i can see its structure based on the $MSG i am sending at the end of the client script. Right?
(please don't laugh at my code):
shyeah, like i'm qualified to do so.
case $TESTNAME in
foo)
# Snag each foo data line
FOO_ALL=`grep "FOO_Events:" $FNAME | awk '{print $3}'`this is where i was getting conf00zed. I was wondering what psychic powers you people were employing to know how to pick out what you wanted blindly :).
# Print out RRD Foo Dataset definitions
echo "DS:Events:GAUGE:600:0:U"
echo "DS:Notifications:GAUGE:600:0:U"
echo "foo.rrd"
echo "$FOO_ALL:$FOO_NOTIFY"and this i'll just have to look up to make sure of. Thank you! I think it's starting to coalesce in my congealed brain...
-----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 9:33 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrd I'm askin' the wrong questions, i just realized. For custom test Foo which has Custom Script Foo.sh, which is a clientside script living in ~/client/ext; assuming all other .cfg acrobatics have been accomplished, where on the server am i going to find the raw $host.foo data/numbers for me to
parse and pass on? I understand i can maybe copy someone else's macro for it, but i need to see what the raw data looks like so i know what i'm parsing :D. tia,
- -- 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 iD8DBQFFN5ZnBvBcJFK6xYURAoAsAJ9RcsbnlCxv6hvxh9X3faafQ3pJmQCcDIKO QrAIouK6rFoiE2bBA15wlU4= =2WEU -----END PGP SIGNATURE-----
list Rob Munsch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am completely clueless. OK, sanity check requested. According to
existing docs on the site, i made the following changes, but all i get
on the graph page is
hobbit graph ncv:cputemp
Now, if my data was bad, i'd have a blank graph, one where all the
values show as "nan." I'm not even getting that, so i am back even
further than i thought. I have...
in hobbitlaunch.cfg
[cputemp]
ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
CMD $BBHOME/ext/cputemp.sh
LOGFILE $BBSERVERLOGS/cputemp.log
INTERVAL 1m
- ---
in hobbitgraph.cg
[cputemp]
TITLE CPU Temp
YAXIS Degrees Fahrenheit
DEF:cputemp=cputemp.rrd:cputemp:AVERAGE
LINE2:cputemp#00CC00:CPU Temp
GPRINT:cputemp:LAST:Cpu Temperature \: %5.11f%s (cur)
GPRINT:cputemp:MAX: \: %5.1lf%s (max)
GPRINT:cputemp:MIN: \: %5.1lf%s (min)
GPRINT:cputemp:AVERAGE: \: %5.1lf%s (avg)\n
- ---
in hobbitserver.cfg
TEST2RRD="cpu=la,disk,inode,qtree,...,bind,cputemp=ncv"
and
GRAPHS="ncv,la,disk,...,bbproxy,hobbitd,cputemp"
and
NCV_cputemp="cputemp:GAUGE"
- ---
TIA. I have a feeling the key is something in here. somewhere. somehow.
▸
Hubbard, Greg L wrote:You got it, big man -- just remember to "pitch" what you know you can "catch". Since the catcher script KNOWS which test it is parsing, you can be as sloppy as you want. -----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 10:15 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrd Hubbard, Greg L wrote:Hey Rob,What is being passed is all the text you so carefully sent in your client-side text. That is why it is important to "pitch" what you can"catch."OH, so, you know how to craft your greps and awks based on the MSG you are sending from the client, is that it? I don't need to find and examine that passed data, because i can see its structure based on the $MSG i am sending at the end of the client script. Right?(please don't laugh at my code):shyeah, like i'm qualified to do so.case $TESTNAME infoo) # Snag each foo data lineFOO_ALL=`grep "FOO_Events:" $FNAME | awk '{print $3}'`this is where i was getting conf00zed. I was wondering what psychic powers you people were employing to know how to pick out what you wanted blindly :).# Print out RRD Foo Dataset definitionsecho "DS:Events:GAUGE:600:0:U" echo "DS:Notifications:GAUGE:600:0:U" echo "foo.rrd" echo "$FOO_ALL:$FOO_NOTIFY"and this i'll just have to look up to make sure of. Thank you! I think it's starting to coalesce in my congealed brain...-----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 9:33 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrdI'm askin' the wrong questions, i just realized.For custom test Foo which has Custom Script Foo.sh, which is a clientside script living in ~/client/ext;assuming all other .cfg acrobatics have been accomplished, where on the server am i going to find the raw $host.foo data/numbers for me toparse and pass on?I understand i can maybe copy someone else's macro for it, but i need to see what the raw data looks like so i know what i'm parsing :D.tia,
- -- 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
iD8DBQFFN5zaBvBcJFK6xYURArenAJ0SIqG44vJBrRSXa3a11iTkRrDW7QCfRo4f
4+ZfwrLvZTSWEKVT9jsPAwE=
=PQNm
-----END PGP SIGNATURE-----
list Greg L Hubbard
Yes, you are using the NCV method, instead of the explicit "pitcher/catcher" method. Which do you want to use? If you use NCV, the Hobbit server will make a valiant attempt to pick out your data from the text of your message, but only if it is in the proper format. This is a can of worms I quickly threw overboard when I started adding my own custom tests. If you bind a column (text) to NCV, the custom parser script will not be called. Look in the NCV section of the hobbitd_rrd man page to see how the data needs to look. You need to make sure that your are sending "cputemp : <number>" or "cputemp = <number>" somewhere in your status message. Or maybe it has to be "cputemp:<number>" or "cputemp: <number>" -- see why I never got it to work? The documentation is hazy about whether or not spaces are required, and which combinations will be okay or not. This is why I quit trying and went for the use-my-own-sledgehammer approach.
▸
GLH
-----Original Message-----
From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid]
Sent: Thursday, October 19, 2006 10:42 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Sending data from script to an rrd
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am completely clueless. OK, sanity check requested. According to
existing docs on the site, i made the following changes, but all i get
on the graph page is
hobbit graph ncv:cputemp
Now, if my data was bad, i'd have a blank graph, one where all the
values show as "nan." I'm not even getting that, so i am back even
further than i thought. I have...
in hobbitlaunch.cfg
[cputemp]
ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
CMD $BBHOME/ext/cputemp.sh
LOGFILE $BBSERVERLOGS/cputemp.log
INTERVAL 1m
- ---
in hobbitgraph.cg
[cputemp]
TITLE CPU Temp
YAXIS Degrees Fahrenheit
DEF:cputemp=cputemp.rrd:cputemp:AVERAGE
LINE2:cputemp#00CC00:CPU Temp
GPRINT:cputemp:LAST:Cpu Temperature \: %5.11f%s (cur)
GPRINT:cputemp:MAX: \: %5.1lf%s (max)
GPRINT:cputemp:MIN: \: %5.1lf%s (min)
GPRINT:cputemp:AVERAGE: \: %5.1lf%s (avg)\n
- ---
in hobbitserver.cfg
TEST2RRD="cpu=la,disk,inode,qtree,...,bind,cputemp=ncv"
and
GRAPHS="ncv,la,disk,...,bbproxy,hobbitd,cputemp"
and
NCV_cputemp="cputemp:GAUGE"
- ---
TIA. I have a feeling the key is something in here. somewhere. somehow.
Hubbard, Greg L wrote:You got it, big man -- just remember to "pitch" what you know you can "catch". Since the catcher script KNOWS which test it is parsing, you
can be as sloppy as you want. -----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 10:15 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrd Hubbard, Greg L wrote:Hey Rob,What is being passed is all the text you so carefully sent in your client-side text. That is why it is important to "pitch" what you can"catch."OH, so, you know how to craft your greps and awks based on the MSG you
are sending from the client, is that it? I don't need to find and examine that passed data, because i can see its structure based on the
$MSG i am sending at the end of the client script. Right?(please don't laugh at my code):shyeah, like i'm qualified to do so.case $TESTNAME infoo) # Snag each foo data lineFOO_ALL=`grep "FOO_Events:" $FNAME | awk '{print $3}'`this is where i was getting conf00zed. I was wondering what psychic powers you people were employing to know how to pick out what you wanted blindly :).# Print out RRD Foo Dataset definitionsecho "DS:Events:GAUGE:600:0:U" echo "DS:Notifications:GAUGE:600:0:U" echo "foo.rrd" echo "$FOO_ALL:$FOO_NOTIFY"and this i'll just have to look up to make sure of. Thank you! I think it's starting to coalesce in my congealed brain...-----Original Message----- From: Rob Munsch [mailto:user-f39e4aae1456@xymon.invalid] Sent: Thursday, October 19, 2006 9:33 AM To: user-ae9b8668bcde@xymon.invalid Subject: Re: [hobbit] Sending data from script to an rrdI'm askin' the wrong questions, i just realized.For custom test Foo which has Custom Script Foo.sh, which is a clientside script living in ~/client/ext;assuming all other .cfg acrobatics have been accomplished, where on the server am i going to find the raw $host.foo data/numbers for me toparse and pass on?I understand i can maybe copy someone else's macro for it, but i need
to see what the raw data looks like so i know what i'm parsing :D.tia,
- -- 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 iD8DBQFFN5zaBvBcJFK6xYURArenAJ0SIqG44vJBrRSXa3a11iTkRrDW7QCfRo4f 4+ZfwrLvZTSWEKVT9jsPAwE= =PQNm -----END PGP SIGNATURE-----