def build(self, domain): if domain is None: raise ValueError("domain is None") if not domain._hostKey: raise ValueError("host key is empty") hostOsh = modeling.createCompleteHostOSH('node', domain._hostKey) if domain._hostname: hostOsh.setAttribute('name', domain._hostname) if domain.memorySize.value() is not None: memorySizeMegabytes = int(domain.memorySize.value() / (1024*1024)) modeling.setHostMemorySizeAttribute(hostOsh, memorySizeMegabytes) return hostOsh
def build(self, domain): if domain is None: raise ValueError("domain is None") if not domain._hostKey: raise ValueError("host key is empty") hostOsh = modeling.createCompleteHostOSH("node", domain._hostKey) if domain._hostname: hostOsh.setAttribute("name", domain._hostname) if domain.memorySize.value() is not None: memorySizeMegabytes = int(domain.memorySize.value() / (1024 * 1024)) modeling.setHostMemorySizeAttribute(hostOsh, memorySizeMegabytes) return hostOsh
def build(self, device): if device is None: raise ValueError("device is None") deviceClass = self.getDeviceClass(device) deviceOsh = ObjectStateHolder(deviceClass) deviceOsh.setBoolAttribute('host_iscomplete', True) deviceOsh = self.setDeviceRoles(device, deviceOsh) hostName = device.hostName domainName = None if hostName and not ip_addr.isValidIpAddress(hostName): hostName, domainName = self.getHostNameAndDomain(hostName) if hostName: deviceOsh.setStringAttribute('name', hostName) if domainName: deviceOsh.setStringAttribute('host_osdomain', domainName) if device.serialNumber: modeling.setHostSerialNumberAttribute(deviceOsh, device.serialNumber) if device.model: modeling.setHostModelAttribute(deviceOsh, device.model) if device.vendor: deviceOsh.setStringAttribute('discovered_vendor', device.vendor) if device.softwareVersion: deviceOsh.setStringAttribute('discovered_os_version', device.softwareVersion) if device.memory: memoryMb = int(device.memory / (1024 * 1024)) modeling.setHostMemorySizeAttribute(deviceOsh, memoryMb) return deviceOsh
def build(self, device): if device is None: raise ValueError("device is None") deviceClass = self.getDeviceClass(device) deviceOsh = ObjectStateHolder(deviceClass) deviceOsh.setBoolAttribute("host_iscomplete", True) deviceOsh = self.setDeviceRoles(device, deviceOsh) hostName = device.hostName domainName = None if hostName and not ip_addr.isValidIpAddress(hostName): hostName, domainName = self.getHostNameAndDomain(hostName) if hostName: deviceOsh.setStringAttribute("name", hostName) if domainName: deviceOsh.setStringAttribute("host_osdomain", domainName) if device.serialNumber: modeling.setHostSerialNumberAttribute(deviceOsh, device.serialNumber) if device.model: modeling.setHostModelAttribute(deviceOsh, device.model) if device.vendor: deviceOsh.setStringAttribute("discovered_vendor", device.vendor) if device.softwareVersion: deviceOsh.setStringAttribute("discovered_os_version", device.softwareVersion) if device.memory: memoryMb = int(device.memory / (1024 * 1024)) modeling.setHostMemorySizeAttribute(deviceOsh, memoryMb) return deviceOsh
def _report90(vector, hostOsh, sizeInKb): 'ObjectStateHolderVector, ObjectStateHolder, int' modeling.setHostMemorySizeAttribute(hostOsh, _kbToMb(sizeInKb))
def _build_host(host, hostName): '@types: Host, str -> osh' hostOS = host.os or '' # Get OS information and build appropriate CI Type if hostOS: debugPrint(4, '[discoverServers] Got Server <%s> with OS <%s>' % (hostName, hostOS)) if hostOS.lower().find('windows') >= 0: hostClass = 'nt' elif hostOS.lower().find('netapp') >= 0: hostClass = 'netapp_filer' elif (hostOS.lower().find('unix') >= 0 or hostOS.lower().find('solaris') >= 0 or hostOS.lower().find('hp') >= 0 or hostOS.lower().find('linux') >= 0 or hostOS.lower().find('aix') >= 0): hostClass = 'unix' if hostClass: debugPrint(4, '[discoverServers] Using HOST class <%s>' % hostClass) # Check for a valid IP before creating CIs if ip_addr.isValidIpAddress(host.ip): hostOSH = modeling.createHostOSH(str(host.ip), hostClass) else: logger.debug('[discoverServers] IP address not available for Server <%s> with ID <%s>!! Creating Host with ID as primary key...' % (hostName, host.id)) hostKey = host.id + ' (ECC ID)' hostOSH = modeling.createCompleteHostOSH(hostClass, hostKey) hostOSH.setAttribute('data_note', 'IP address unavailable in ECC - Duplication of this CI is possible') # # Set node role in UCMDB 9 and above for compatibility with SM integration if hostOS and (hostOS.lower().find('xp') > -1 or hostOS.lower().find('vista') > -1 or hostOS.lower().find('professional') > -1 or hostOS.lower().find('windows 7') > -1): hostOSH.setListAttribute('node_role', ['desktop']) else: hostOSH.setListAttribute('node_role', ['server']) hostModel = host.model if (hostModel and (hostModel.lower().find('vmware') > -1 or hostModel.lower().find('zone') > -1 or hostModel.lower().find('virtual') > -1)): hostOSH.setListAttribute('node_role', ['virtualized_system']) # # Set Host OS install Type to match HC jobs osInstallType = '' if hostOS: if hostOS.lower().find('hp-ux') > -1 or hostOS.lower().find('hpux') > -1: osInstallType = 'HPUX' elif hostOS.lower().find('linux') > -1 or hostOS.lower().find('redhat') > -1 or hostOS.lower().find('suse') > -1: osInstallType = 'Linux' elif hostOS.lower().find('solaris') > -1 or hostOS.lower().find('sun') > -1: osInstallType = 'Solaris' elif hostOS.lower().find('aix') > -1: osInstallType = 'AIX' elif hostOS.lower().find('enterprise x64 edition') > -1: osInstallType = 'Server Enterprise x64 Edition' elif hostOS.lower().find('enterprise edition') > -1: osInstallType = 'Server Enterprise Edition' elif hostOS.lower().find('server enterprise') > -1: osInstallType = 'Server Enterprise' elif hostOS.lower().find('enterprise') > -1: osInstallType = 'Enterprise' elif hostOS.lower().find('professional') > -1: osInstallType = 'Professional' elif hostOS.lower().find('standard edition') > -1: osInstallType = 'Server Standard Edition' elif hostOS.lower().find('standard') > -1: osInstallType = 'Server Standard' elif hostOS.lower().find('server') > -1: osInstallType = 'Server' elif hostOS.lower().find('business') > -1: osInstallType = 'Business' # # Set Host OS to match HC jobs if hostOS: if hostOS.lower().find('2003') > -1: hostOS = 'Windows 2003' elif hostOS.lower().find('2008') > -1: hostOS = 'Windows 2008' elif hostOS.lower().find('2008 R2') > -1: hostOS = 'Windows 2008 R2' elif hostOS.lower().find('2000') > -1: hostOS = 'Windows 2000' elif hostOS.lower().find('windows 7') > -1: hostOS = 'Windows 7' elif hostOS.lower().find('vista') > -1: hostOS = 'Windows Vista' elif hostOS.lower().find('xp') > -1: hostOS = 'Windows XP' elif hostOS.lower().find('aix') > -1: hostOS = 'AIX' elif hostOS.lower().find('solaris') > -1 or hostOS.lower().find('sun') > -1: hostOS = 'Solaris' elif hostOS.lower().find('linux') > -1 or hostOS.lower().find('redhat') > -1 or hostOS.lower().find('suse') > -1: hostOS = 'Linux' elif hostOS.lower().find('hp-ux') > -1 or hostOS.lower().find('hpux') > -1: hostOS = 'HP-UX' else: hostOS = '' memorySizeInKb = host.installedmemory if memorySizeInKb: memorySizeInMb = memorySizeInKb / 1024 modeling.setHostMemorySizeAttribute(hostOSH, memorySizeInMb) populateOSH(hostOSH, {'data_name': hostName, 'host_model':hostModel, 'host_vendor': host.vendorname, 'host_os':hostOS, 'host_osversion': host.osversion, 'host_osinstalltype':osInstallType}) return hostOSH