nv-l
[Top] [All Lists]

Re: MIBs on Cisco Cat4003/4006

To: nv-l@lists.tivoli.com
Subject: Re: MIBs on Cisco Cat4003/4006
From: Jane Curry <jane.curry@skills-1st.co.uk>
Date: Sun, 09 Jul 2000 20:44:54 +0100
I have a generic script that tries to determine what devices are
attached to what hubs / switches.  It uses a standard MIB variable that
comes out of the bridge subtree of MIB-2 (as a switch is effectively a
multi-port bridge).  Here is the script if it is useful - no guarantees,
as ever!

Regards, Jane

# Modification date: 5/1/2000
# Uses NetView mibtable command to get mac addresses
#    associated with switches into
/usr/OV/conf/skills/switch_macaddr.temp
# NetView nvUtil command used to supply members of NetView collections
#   as the hub / switch names.  These collections are maintained
#   dynamically by NetView
# Munges information into format
#  MAC Address switch_name   port no
# Output sorted by switch name into
/usr/OV/conf/skills/switches_to_mac.out
# and by MAC Address in /usr/OV/conf/skills/mac_to_switches.out
#
# Edit next line for name of NetView collection representing all
Switches
# You can define this with the "isBridge" attribute
#
SWITCH_COL=Switches

# Check that the NetView nvcold is running

RUNNING=`/usr/OV/bin/ovstatus nvcold | grep RUNNING | awk '{print $2}'`
if [ $RUNNING != "RUNNING" ]
then
  echo "NetView Collection daemon, nvcold, not running - exiting"
  exit 0
fi

cat /dev/null > /usr/OV/conf/skills/switch_macaddr.temp

for i in `/usr/OV/bin/nvUtil l $SWITCH_COL`
do
   echo "$i"
#
#  Get the MIB variables representing MAC address(es) seen by port(s)
#  This comes out of the Bridge subtree of MIB-2
#
   /usr/OV/bin/mibtable -table .1.3.6.1.2.1.17.4.3.1  \
  -fields dot1dTpFdbAddress=1:48,dot1dTpFdbPort=2:11  \
  -node "$i"  \
  >> /usr/OV/conf/skills/switch_macaddr.temp
done

cat /dev/null > /usr/OV/conf/skills/switches_to_mac.out
cat /dev/null > /usr/OV/conf/skills/mac_to_switches.out
cat /usr/OV/conf/skills/switch_macaddr.temp | \
 awk '
        /User Specified MIB Table/      {switchname=$6}
        /^[0-9A-F][0-9A-F] /
{printf("0x%s%s%s%s%s%s\t%s\t%s\n",$1,$2,$3,$4,$5,$6,switchname,$7)}
 ' "$@"   \
   | sort -k7,7 -k8,8n \
   >> /usr/OV/conf/skills/switches_to_mac.out

sort -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6
/usr/OV/conf/skills/switches_to_mac.out >
/usr/OV/conf/skills/mac_to_switches.out
.

--
Tivoli Certified Enterprise Consultant & Instructor
Skills 1st Limited, 2 Cedar Chase, Taplow, Bucks, SL6 0EU, UK
Tel: +44 (0)1628 782565
Copyright (c) 2000 Jane Curry <jane.curry@skills-1st.co.uk>.  All rights
reserved.


<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web