Community
Zenoss Newsletter

Monitored by Zenoss
SourceForge.net Logo
Views

Model 3Com Switch Data

Many manufacturer specific data is supported by default, but 3Com was left out. This page will show you how to retrieve the switch serial number, product number, and software version.

Create Python script

Log in as 'zenoss' and create the file 'ThreeComDeviceMap?.py' in the folder: '/usr/local/zenoss/Products/DataCollector?/plugins/zenoss/snmp/' The content of the file is below.

__doc__="""ThreeComDeviceMap
 
ThreeComDeviceMap maps 3Com product information"""
 
from CollectorPlugin import SnmpPlugin, GetMap
 
class ThreeComDeviceMap(SnmpPlugin):
 
    maptype = "ThreeComDeviceMap" 
 
    snmpGetMap = GetMap({ 
        '.1.3.6.1.4.1.43.10.27.1.1.1.13.1' : 'setHWSerialNumber',
        # Some older devices provide the serial number at '.1.3.6.1.4.1.43.10.27.1.1.1.13.2'
        # This line gets the 3Com product number
        #'.1.3.6.1.4.1.43.10.27.1.1.1.19.1' : 'setHWProductKey',
        # This line gets the firmware version
        #'.1.3.6.1.4.1.43.10.27.1.1.1.12.1': 'setOSProductKey',
         })
 
 
    def condition(self, device, log):
        """does device meet the proper conditions for this collector to run"""
        return device.snmpOid.startswith('.1.3.6.1.4.1.43')
 
 
    def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info('processing %s for device %s', self.name(), device.id)
        getdata, tabledata = results
        return self.objectMap(getdata)

Restart Zope

You can do this through the ZMI (http://[zenoss]:8080/manage) or the Zenoss service '$/etc/init.d/zenoss restart'

Add the collector

In order for this script to be used, you should dedicate a device class to the 3Com products. This is how you define a collector to apply to all devices within the class:

  • Navigate to the device class
  • Click the main menu arrow -> More -> Collector Plugins
  • Click the 'Add Fields' link
  • Drag 'zenoss.snmp.ThreeComDeviceMap?' to the left box
  • Click the 'Save' button

Complete

You are now finished. Once the devices are remodeled, you will see the new information.