[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] scripting help



On Thursday 06 September 2007 20:36:52 Stef Coene wrote:
> On Thursday 06 September 2007, Jason Chambers wrote:
> > Just to clarify, I need to know a way to parse out the # part of blade:#
> > from bb-hosts.
> >
> > I don't know if there is a scripting mailing list for hobbit exclusively,
> > and my scripting abilities is very basic, so any help would be awesome!
> > :)
>
> There is only one mailing list, this one.
>
> bbhostshow will dump the bb-hosts file.  You can use perl or shell to parse
> the lines you need.  I prefer perl to parse text.  Somethine like:
>
> ./bbhostshow | perl -e 'while (<STDIN>) { if ( $_ =~ /blade:(.+) / ) {
> print "BLADE: $1\n\n" ; } } '

While I couldn't use devmon, I used something like this:

I would rather tag the entries with a new tag, and use bbhostgrep

#!/bin/bash

if [ -z "$BBHOME" ]
then
        echo "BBHOME not set" >&2
        exit 1
fi

TESTNAME="radperf"
SNMPPORT="161"
SNMPCOMM="xxx"

$BBHOME/bin/bbhostgrep $TESTNAME|while read IP NAME JUNK TESTS
do
        DATA=`snmpget -v1 -c $SNMPCOMM $NAME:$SNMPPORT 
1.3.6.1.2.1.67.1.1.1.1.5 1.3.6.1.2.1.67.1.1.1.1.6  1.3.6.1.2.1.67.1.1.1.1.7   
1.3.6.1.2.1.67.1.1.1.1.8 1.3.6.1.2.1.67.1.1.1.1.9|
sed -e 's/SNMPv2-SMI::mib-2.67.1.1.1.1.//g;s/= 
INTEGER//g;s/^5/requests/;s/^6/invalid/;s/^7/dupes/;s/^8/accepts/;s/^9/rejects/'`
        $BBHOME/bin/bb $BBDISP "status ${NAME//./,}.${TESTNAME} green `date`
$DATA
"
done


Regards,
Buchan