[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] scripting help
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] scripting help
- From: Buchan Milne <bgmilne (at) staff.telkomsa.net>
- Date: Thu, 6 Sep 2007 20:58:59 +0200
- Cc: Stef Coene <stef.coene (at) docum.org>
- References: <5FE94042A3B7764CA4E47D5F670889ED0994E88F (at) reddo.geosoft.com> <5FE94042A3B7764CA4E47D5F670889ED0994E890 (at) reddo.geosoft.com> <200709062036.53259.stef.coene (at) docum.org>
- User-agent: KMail/1.9.6
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