示例#1
0
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()
    jobId = Framework.getDiscoveryJobId()
    host_id    = Framework.getDestinationAttribute('id')
    host_name = Framework.getTriggerCIData('host_name')
    dnsServers = Framework.getTriggerCIDataAsList('dnsServers') or None
        
    try:
        host_name = host_name.split(" ")
        ips = pi_utils.getIPs(host_name[0], Framework)
        
        if not ips:
            raise ValueError()
        
        hostOSH = modeling.createOshByCmdbIdString('node', host_id)
        modeling.addHostAttributes(hostOSH, None, host_name[0])
        #OSHVResult.add(hostOSH)       
        
        for ip in ips:
            ipRes = pi_utils.getIPOSHV(Framework, ip, None, dnsServers, False, True)
            if ipRes.size() > 0:               
                OSHVResult.add(modeling.createLinkOSH('containment',hostOSH,modeling.createIpOSH(ip)))
                OSHVResult.addAll(ipRes)
        if OSHVResult.size() <=0:
            raise ValueError()       
    except Exception, e:
        msg = logger.prepareJythonStackTrace("Error getting IPs for %s: " % (host_name), e)
        errormessages.resolveAndReport(msg, jobId, Framework)
        logger.error(msg)
示例#2
0
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()
    jobId = Framework.getDiscoveryJobId()
    host_id = Framework.getDestinationAttribute('id')
    host_name = Framework.getTriggerCIData('host_name')
    dnsServers = Framework.getTriggerCIDataAsList('dnsServers') or None

    try:
        host_name = host_name.split(" ")
        ips = pi_utils.getIPs(host_name[0], Framework)

        if not ips:
            raise ValueError()

        hostOSH = modeling.createOshByCmdbIdString('node', host_id)
        modeling.addHostAttributes(hostOSH, None, host_name[0])
        #OSHVResult.add(hostOSH)

        for ip in ips:
            ipRes = pi_utils.getIPOSHV(Framework, ip, None, dnsServers, False,
                                       True)
            if ipRes.size() > 0:
                OSHVResult.add(
                    modeling.createLinkOSH('containment', hostOSH,
                                           modeling.createIpOSH(ip)))
                OSHVResult.addAll(ipRes)
        if OSHVResult.size() <= 0:
            raise ValueError()
    except Exception, e:
        msg = logger.prepareJythonStackTrace(
            "Error getting IPs for %s: " % (host_name), e)
        errormessages.resolveAndReport(msg, jobId, Framework)
        logger.error(msg)
示例#3
0
def DiscoveryMain(Framework):
    ip      =  Framework.getTriggerCIData('ip')   
    dnsServers =   Framework.getTriggerCIDataAsList('dns_servers')    
    netmask =Framework.getTriggerCIData('netmask') or None    
 
    OSHVResult = pi_utils.getIPOSHV(Framework, ip, netmask, dnsServers, False)
   
    return OSHVResult