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
        #if getdata['setHWProductKey'] is None: return None
        om = self.objectMap(getdata)
        #Attempt to determine the registered manufacturer from snmp oid
        #If we cant find a registered name, assign it an identifiable default
        if om.sysObjectID:
            match = re.match(r'(.\d+){7}', om.sysObjectID)
            if match:
                manufacturer = EnterpriseOIDs.get(match.group(0), 
                                                  'F5 Labs, Inc.')
            else:
                manufacturer = None
            
        device_model = self._determine_device_model(om)
            

        # Build a product build and version string to populate the OSModel field
        # Also set the manufacturer_name
        os_model = " ".join([om.sysProductName, om.sysProductVersion, 
                             om.sysProductBuild, om.sysProductEdition])
        om.setOSProductKey = MultiArgs(os_model, manufacturer)
        
            
        # Now set it. I'm not entirely up to speed on this method, 
        # But in testing the multiargs stuff will populate two fields in the GUI
      
        om.setHWProductKey = MultiArgs(device_model, manufacturer)
        return om
    def process(self, device, results, log):
        getData, tabledata = results
        om = self.objectMap()
        if not getData.has_key('setHWSerialNumber') or not getData['setHWSerialNumber']:
          om.setHWSerialNumber='N/A'
        else:
          om.setHWSerialNumber=getData['setHWSerialNumber']

        if getData['snmpOid']:
            match = re.match(r'(.\d+){7}',getData['snmpOid'])
            if match:
                manufacturer = EnterpriseOIDs.get(match.group(0), None)
            else:
                manufacturer = None
            if getData.has_key('modelName'):
              om.setHWProductKey = MultiArgs(getData['modelName'], manufacturer)
            else:
              om.setHWProductKey = MultiArgs(getData['snmpOid'], manufacturer)
            log.debug("HWProductKey=%s", om.setHWProductKey)
        return om
Beispiel #3
0
    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
        if not getdata:
            log.warn("Unable to retrieve getdata from %s", device.id)
            log.warn("Does snmpwalk -v1 -c community %s 1.3.6.1.2.1.1 work?",
                     device.id)
            return
        log.debug("%s getdata = %s", device.id, getdata)
        om = self.objectMap(getdata)

        # Set the manufacturer according the IANA enterprise OID assignments.
        if om.snmpOid:
            match = re.match(r'(.\d+){7}', om.snmpOid)
            if match:
                manufacturer = EnterpriseOIDs.get(match.group(0), None)
            else:
                manufacturer = None

            om.setHWProductKey = MultiArgs(om.snmpOid, manufacturer)
            log.debug("HWProductKey=%s", om.setHWProductKey)

        if om.snmpDescr:
            descr = re.sub("\s", " ", om.snmpDescr)
            for regex in self.osregex:
                m = regex.search(descr)
                if m:
                    groups = m.groups()
                    if groups[0] == 'SunOS':
                        om.setOSProductKey = MultiArgs(" ".join(groups[0:3]),
                                                       'Sun')
                    else:
                        om.setOSProductKey = " ".join(groups)
                    log.debug("OSProductKey=%s", om.setOSProductKey)
                    break
        return om
    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
        if not getdata:
            log.warn("Unable to retrieve getdata from %s", device.id)
            log.warn("Does snmpwalk -v1 -c community %s 1.3.6.1.2.1.1 work?", 
                     device.id)
            return
        log.debug("%s getdata = %s", device.id, getdata)
        om = self.objectMap(getdata)
        
        # Set the manufacturer according the IANA enterprise OID assignments.
        if om.snmpOid:
            match = re.match(r'(.\d+){7}', om.snmpOid)
            if match:
                manufacturer = EnterpriseOIDs.get(match.group(0), None)
            else:
                manufacturer = None

            om.setHWProductKey = MultiArgs(om.snmpOid, manufacturer)
            log.debug("HWProductKey=%s", om.setHWProductKey)
        
        if om.snmpDescr:
            descr = re.sub("\s", " ", om.snmpDescr)
            for regex in self.osregex:
                m = regex.search(descr)
                if m: 
                    groups = m.groups()
                    if groups[0] == 'SunOS':
                        om.setOSProductKey = MultiArgs(" ".join(groups[0:3])
                                                     , 'Sun')
                    else:
                        om.setOSProductKey = " ".join(groups)
                    log.debug("OSProductKey=%s", om.setOSProductKey)
                    break
        return om