#!/bin/sh

# Simple bottom-feeder script to pick up the BEA statistics
# via SNMP, and feed them to Hobbit.
#
# This collects the JRockit JVM statistics, and the runtime
# thread info from a BEA Management node, managing a number
# of servers in the "ProdDomain" domain. The SNMP community
# name is "public", but BEA uses "public@DOMAIN" to get the
# statistics for each of the managed nodes. If you specify
# just "public" you get statistics for the management server
# itself - and they are normally not very interesting.

if [ "$BBTMP" = "" ]
then
    BBHOME=/usr/local/bb/bb
    export BBHOME
    . $BBHOME/etc/bbdef.sh
fi

$BBHOME/bin/bbhostgrep bea | awk '{print $1 " " $2}' |
while read IP HOSTNAME
do
    HOSTC=`echo $HOSTNAME | sed 's/\./,/g'`

    $BB $BBDISP "status ${HOSTC}.bea green `date` BEA Statistics

`snmpwalk -m BEA-WEBLOGIC-MIB -c public@ProdDomain -v 1 ${IP}:1161 enterprises.140.625.302.1 | grep -v jrockitRuntimeThreadStackDump`
`snmpwalk -m BEA-WEBLOGIC-MIB -c public@ProdDomain -v 1 ${IP}:1161 enterprises.140.625.180.1 | grep -v executeQueueRuntimeExecuteThreads`

"
done

exit 0

