def process(self, device, results, log): """collect CIM information from this device""" log.info('processing %s for device %s', self.name(), device.id) maps = [] rm = self.relMap() instances = results.get("CIM_ComputerSystem") if not instances: return rm sysnames = self._getSysnames(device, results, "CIM_ComputerSystem") sysname = sysnames[0] for inst in instances: subsysname = (inst.get("_sysname") or "").lower() if subsysname not in sysnames: continue try: inst.update(self._getPackage(results, inst)) productKey = inst.get("setProductKey") if (len(instances)==1) or (not maps and (sysname in subsysname)): om = ObjectMap() om.snmpindex = inst.get("setPath") or "" om.snmpSysName = subsysname om.snmpDescr = inst.get("_descr") or "" om.snmpContact = inst.get("_contact") or "" if productKey: om.setHWProductKey = MultiArgs(productKey, inst.get("_manuf") or "Unknown") serialNumber = inst.get("serialNumber") if serialNumber: om.setHWSerialNumber = serialNumber tag = inst.get("tag") if tag: om.setHWTag = tag maps.append(om) continue if not productKey: continue self._setCimStatusName(inst) om = self.objectMap(inst) om.id = self.prepId(inst.get("_sysname") or "") if not om.id: continue om.setProductKey = MultiArgs(productKey, inst.get("_manuf") or "Unknown") om.slot = self._getSlot(results, inst) collections = self._getCollections(results, inst) if collections: om.setCollections = collections statPath = self._getStatPath(results, inst) if statPath: om.setStatPath = statPath om.monitor = self._monitor(inst) rm.append(om) except: log.warning('processing error') if len(rm.maps) > 0: maps.append(rm) return maps
def process(self, device, results, log): """collect CIM information from this device""" log.info("processing %s for device %s", self.name(), device.id) maps = [] rm = self.relMap() instances = results.get("CIM_Chassis") if not instances: return rm sysnames = self._getSysnames(device, results, "CIM_Chassis") sysname = sysnames[0] for inst in instances: if (inst.get("_sysname") or "").lower() not in sysnames: continue try: layout = self._getLayout(results, inst) manuf = inst.get("_manuf") or "Unknown" productKey = inst.get("setProductKey") or "" if not maps and self._isSystemChassis(results, sysname, inst): if not inst: continue om = ObjectMap() if productKey or (manuf != "Unknown"): om.setHWProductKey = MultiArgs(productKey, manuf) serialNumber = inst.get("serialNumber") or "" if serialNumber: om.setHWSerialNumber = serialNumber tag = inst.get("tag") or inst.get("id") or "" if tag: if tag.startswith(serialNumber) and tag != serialNumber: tag = tag[len(serialNumber):] om.setHWTag = tag maps.append(om) continue self._setCimStatusName(inst) om = self.objectMap(inst) om.id = self.prepId(om.id) if not om.id: continue if productKey or (manuf != "Unknown"): om.setProductKey = MultiArgs(productKey, manuf) if layout: om.layout = layout except AttributeError: continue rm.append(om) maps.append(rm) return maps