[hobbit] Sending data from script to an rrd

Hubbard, Greg L greg.hubbard at eds.com
Thu Oct 19 17:05:54 CEST 2006


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:rmunsch at solutionsforprogress.com] 
Sent: Thursday, October 19, 2006 9:33 AM
To: hobbit at hswn.dk
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-----

To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk





More information about the Xymon mailing list