:D :D :D :D :D
Below is the section of code from InterfaceMap.py that I modified to get this
to work:
/opt/zenoss/Products/DataCollector/plugins/zenoss/snmp/InterfaceMap.py
For those interested, in the last section of code I cycle through the ifCatOS
map to find the index match with the iftable because I am not sure that they
are in the same order when being read by SNMP. If they are in the same order,
the code could be simplified even further. It's not elegant, but it works.
Code:
snmpGetTableMaps = (
# If table
GetTableMap('iftable', '.1.3.6.1.2.1',
{'.2.2.1.1': 'ifindex',
'.2.2.1.2' : 'id',
# -------------------------------------------------
# Added to get CatOS port name
# --------------------------------------------------
'.31.1.1.1.1': 'id',
# --------------------------------------------------
'.2.2.1.3': 'type',
'.2.2.1.4': 'mtu',
'.2.2.1.5': 'speed',
'.2.2.1.6': 'macaddress',
'.2.2.1.7': 'adminStatus',
'.2.2.1.8': 'operStatus'}
),
# ipAddrTable is the better way to get IP addresses
GetTableMap('ipAddrTable', '.1.3.6.1.2.1.4.20.1',
{'.1': 'ipAddress',
'.2': 'ifindex',
'.3': 'netmask'}
),
# Use the ipNetToMediaTable as a backup to the ipAddrTable
GetTableMap('ipNetToMediaTable', '.1.3.6.1.2.1.4.22.1',
{'.1': 'ifindex',
'.3': 'ipaddress',
'.4': 'iptype'}
),
# Interface Description
GetTableMap('ifalias', '.1.3.6.1',
{'.2.1.31.1.1.1.18' : 'description',
'.2.1.31.1.1.1.15' : 'highSpeed'}
),
# -------------------------------------------------
# Added to get CatOS descriptions
# --------------------------------------------------
GetTableMap('ifCatOS', '.1.3.6.1.4.1.9.5.1.4.1.1',
{'.11' : 'ifindex',
'.1' : 'ifmodule',
'.2' : 'ifport',
'.4' : 'description',
}
),
# --------------------------------------------------
)
#dontCollectInterfaceTypes = (1, 18, 76, 77, 81, 134)
def process(self, device, results, log):
"""collect snmp information from this device"""
getdata, tabledata = results
log.info('processing %s for device %s', self.name(), device.id)
rm = self.relMap()
iptable = tabledata.get("ipAddrTable") \
or tabledata.get("ipNetToMediaTable")
iftable = tabledata.get("iftable")
ifalias = tabledata.get("ifalias")
if iptable is None or iftable is None: return
if not ifalias: ifalias = {}
# -------------------------------------------------
# Added to get CatOS descriptions
# --------------------------------------------------
ifCatOS = tabledata.get("ifCatOS")
# --------------------------------------------------
# add interface alias (cisco description) to iftable
for ifidx, data in ifalias.items():
if not iftable.has_key(ifidx): continue
iftable[ifidx]['description'] = data.get('description', '')
# if we collect ifAlias name use it
# this is in the map subclass InterfaceAliasMap
id = data.get('id', None)
if id:
iftable[ifidx]['id'] = id
iftable[ifidx]['description'] = data.get('description', '')
# --------------------------------------------------
# Added to get CatOS descriptions
# --------------------------------------------------
if data.get('description', '') == '':
if not ifCatOS: ifCatOS = {}
if ifCatOS <> {}:
for ifidx2, data2 in ifCatOS.items():
if iftable[ifidx]['ifindex'] ==
ifCatOS[ifidx2]['ifindex']:
iftable[ifidx]['description'] =
data2.get('description', ' ')
# --------------------------------------------------
# handle 10GB interfaces using IF-MIB::ifHighSpeed
David
-------------------- m2f --------------------
Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=12633#12633
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users