def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['discovery_probe.exe']
     self.configPathAndVersionPattern = {
         '../../root/lib/collectors/versions.properties': r'probe\.(.*?)\.b',
         '../../version.dat': r'probe\.(.*?)((\.b)|$)'
     }
    def process(self, context):
        logger.debug('UcmdbServer8VersionShellPlugin.process')
        ConfigBasedPlugin.process(self, context)
        processFolder = self.getProcessFolder(context)

        try:
            content = context.client.safecat(processFolder +
                                             '../../conf/FndInfra.ini')
        except:
            logger.reportWarning('Failed getting HP uCMDB configuration')
            return

        hostName = self.getPropertyByRegexp(r'dbHost="(.+)"', content)
        dbType = self.getPropertyByRegexp(r'dbType="(.+)"', content)
        port = self.getPropertyByRegexp(r'dbPort="(\d+)"', content)
        sid = self.getPropertyByRegexp(r'dbSID="(\w+)"', content)
        if hostName and dbType and port and sid:
            dbHostIp = netutils.getHostAddress(hostName.strip())
            if dbHostIp:
                self.reportTopology(context, dbType, port, sid, dbHostIp)
            else:
                logger.warn('Failed resolving DB host "%s" ip address' %
                            hostName)
        else:
            logger.warn('Failed parsing cmdb config file')
    def process(self, context):
        ConfigBasedPlugin.process(self, context)
        processFolder = self.getProcessFolder(context)
        discoveredVersion = ""
        try:
            discoveredVersion = context.application.getOsh().getAttributeValue("application_version_number")
        except:
            logger.debugException('')
        logger.info("Discovered version is: %s" % discoveredVersion)
        if discoveredVersion and not (discoveredVersion.startswith('9')
                                      or discoveredVersion.startswith('10')):
            raise applications.IgnoreApplicationException('UCMDB is not of a proper version')

        try:
            content = context.client.safecat(processFolder + '../../../conf/cmdb.conf')
        except:
            logger.reportWarning('Failed getting HP uCMDB configuration')
            return

        hostName = self.getPropertyByRegexp(r'dal\.datamodel\.host\.name=(.+)', content)
        dbType = self.getPropertyByRegexp(r'dal\.datamodel\.db\.type=(.+)', content)
        port = self.getPropertyByRegexp(r'dal\.datamodel\.port=(\d+)', content)
        sid = self.getPropertyByRegexp(r'dal\.datamodel\.sid=(\w+)', content)
        if ip_addr.isValidIpAddress(hostName):
            ipAddress = hostName
            ipAddress = ipAddress.encode('utf8').strip()
            hostName = netutils.getHostName(ipAddress)
        if (not sid) and hostName:
            sid = hostName.upper().split('.')[0]
        if hostName and dbType and port and sid:
            hostName = hostName.strip()
            resolver = netutils.IpResolver('', context.framework)
            dbHostIp = resolver.resolveHostIp(hostName)
            if dbHostIp:
                self.reportTopology(context, dbType, port, sid, dbHostIp)
            else:
                logger.warn('Failed resolving DB host "%s" ip address' % hostName)
        else:
            logger.warn('Failed parsing cmdb config file (datamodel part)')

        hostName = self.getPropertyByRegexp(r'dal\.history\.host\.name=(.+)', content)
        dbType = self.getPropertyByRegexp(r'dal\.history\.db\.type=(.+)', content)
        port = self.getPropertyByRegexp(r'dal\.history\.port=(\d+)', content)
        sid = self.getPropertyByRegexp(r'dal\.history\.sid=(\w+)', content)
        if ip_addr.isValidIpAddress(hostName):
            ipAddress = hostName
            ipAddress = ipAddress.encode('utf8').strip()
            hostName = netutils.getHostName(ipAddress)
        if (not sid) and hostName:
            sid = hostName.upper().split('.')[0]
        if hostName and dbType and port and sid:
            hostName = hostName.strip()
            resolver = netutils.IpResolver('', context.framework)
            dbHostIp = resolver.resolveHostIp(hostName)
            if dbHostIp:
                self.reportTopology(context, dbType, port, sid, dbHostIp)
            else:
                logger.warn('Failed resolving DB host "%s" ip address' % hostName)
        else:
            logger.warn('Failed parsing cmdb config file (history part)')
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.configPathAndVersionPattern = {
         '../dat/version.txt': r'Version: (.*)\n',
         '../../dat/version.txt': r'Version: (.*)\n',
         '../../dat/Version.txt': r'Version: (.*)\n'
     }
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['SiteScope.exe', 'SiteScope', 'java.exe',
                              'java', 'javaw.exe']
     self.configPathAndVersionPattern = {
             '../../groups/master.config': r'_version=(.+?)\s'}
     self.setVersionDescription = 0
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.configPathAndVersionPattern = {
         '../dat/version.txt': r'Version: (.*)\n',
         '../../dat/version.txt': r'Version: (.*)\n',
         '../../dat/Version.txt': r'Version: (.*)\n'
     }
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['discovery_probe.exe']
     self.configPathAndVersionPattern = {
         '../../root/lib/collectors/versions.properties':
         r'probe\.(.*?)\.b',
         '../../version.dat': r'probe\.(.*?)((\.b)|$)'
     }
 def process(self, context):
     ConfigBasedPlugin.process(self, context)
     discoveredVersion = ""
     try:
         discoveredVersion = context.application.getOsh().getAttributeValue("application_version_number")
     except:
         logger.debugException('')
     if discoveredVersion and not discoveredVersion.startswith('8'):
         raise applications.IgnoreApplicationException('Not a  BAC server')
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = [
         'SiteScope.exe', 'SiteScope', 'java.exe', 'java', 'javaw.exe'
     ]
     self.configPathAndVersionPattern = {
         '../../groups/master.config': r'_version=(.+?)\s'
     }
     self.setVersionDescription = 0
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['QCJavaService.exe']
     self.configPathAndVersionPattern = {
         '../../dat/version.txt':
         r'Version: (.*)',
         '../../conf/versions.xml':
         r'<void property="productVersion">\s*<float>(.*?)</float>'
     }
 def process(self, context):
     ConfigBasedPlugin.process(self, context)
     discoveredVersion = ""
     try:
         discoveredVersion = context.application.getOsh().getAttributeValue(
             "application_version_number")
     except:
         logger.debugException('')
     if discoveredVersion and not discoveredVersion.startswith('8'):
         raise applications.IgnoreApplicationException('Not a  BAC server')
 def isApplicable(self, context):
     applicable = ConfigBasedPlugin.isApplicable(self, context)
     # if top-level plug-in cannot find process path
     # - use default one on *nix machines
     if (self.defaultUnixProcessPath and (not applicable)
             and (not context.client.isWinOs())):
         self.processPath = self.defaultUnixProcessPath
         applicable = 1
     return applicable
 def isApplicable(self, context):
     applicable = ConfigBasedPlugin.isApplicable(self, context)
     # if top-level plug-in cannot find process path
     # - use default one on *nix machines
     if (self.defaultUnixProcessPath
         and (not applicable)
         and (not context.client.isWinOs())):
         self.processPath = self.defaultUnixProcessPath
         applicable = 1
     return applicable
    def process(self, context):
        logger.debug('UcmdbServer8VersionShellPlugin.process')
        ConfigBasedPlugin.process(self, context)
        processFolder = self.getProcessFolder(context)

        try:
            content = context.client.safecat(processFolder + '../../conf/FndInfra.ini')
        except:
            logger.reportWarning('Failed getting HP uCMDB configuration')
            return

        hostName = self.getPropertyByRegexp(r'dbHost="(.+)"', content)
        dbType = self.getPropertyByRegexp(r'dbType="(.+)"', content)
        port = self.getPropertyByRegexp(r'dbPort="(\d+)"', content)
        sid = self.getPropertyByRegexp(r'dbSID="(\w+)"', content)
        if hostName and dbType and port and sid:
            dbHostIp = netutils.getHostAddress(hostName.strip())
            if dbHostIp:
                self.reportTopology(context, dbType, port, sid, dbHostIp)
            else:
                logger.warn('Failed resolving DB host "%s" ip address' % hostName)
        else:
            logger.warn('Failed parsing cmdb config file')
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['QCJavaService.exe']
     self.configPathAndVersionPattern = {
         '../../dat/version.txt': r'Version: (.*)',
         '../../conf/versions.xml': r'<void property="productVersion">\s*<float>(.*?)</float>'}
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.configPathAndVersionPattern = {
         '../../config/Version.properties':
         r'TVISION_MAJOR_VERSION=(\d+).+?TVISION_MINOR_VERSION=(\d+)'
     }
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.defaultUnixProcessPath = None
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.defaultUnixProcessPath = None
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['HPRUM.exe']
     self.configPathAndVersionPattern = {
         '../../dat/version.txt': r'Version: (.*)\n'
     }
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['java.exe', 'java', 'javaw.exe']
     self.configPathAndVersionPattern = {'conf/version.txt': r'([0-9,\.]*)'}
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['HPRUM.exe']
     self.configPathAndVersionPattern = {'../../dat/version.txt': r'Version: (.*)\n'}
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.configPathAndVersionPattern = {
         '../version.txt': r'version=(.+?)(?:\n|$)'
     }
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.configPathAndVersionPattern = {
         '../version.txt': r'version=(.+?)(?:\n|$)'}
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.configPathAndVersionPattern = {
         '../../config/Version.properties': r'TVISION_MAJOR_VERSION=(\d+).+?TVISION_MINOR_VERSION=(\d+)'}
    def process(self, context):
        ConfigBasedPlugin.process(self, context)
        processFolder = self.getProcessFolder(context)
        discoveredVersion = ""
        try:
            discoveredVersion = context.application.getOsh().getAttributeValue(
                "application_version_number")
        except:
            logger.debugException('')
        logger.info("Discovered version is: %s" % discoveredVersion)
        if discoveredVersion and not (discoveredVersion.startswith('9')
                                      or discoveredVersion.startswith('10')):
            raise applications.IgnoreApplicationException(
                'UCMDB is not of a proper version')

        try:
            content = context.client.safecat(processFolder +
                                             '../../../conf/cmdb.conf')
        except:
            logger.reportWarning('Failed getting HP uCMDB configuration')
            return

        hostName = self.getPropertyByRegexp(r'dal\.datamodel\.host\.name=(.+)',
                                            content)
        dbType = self.getPropertyByRegexp(r'dal\.datamodel\.db\.type=(.+)',
                                          content)
        port = self.getPropertyByRegexp(r'dal\.datamodel\.port=(\d+)', content)
        sid = self.getPropertyByRegexp(r'dal\.datamodel\.sid=(\w+)', content)
        if ip_addr.isValidIpAddress(hostName):
            ipAddress = hostName
            ipAddress = ipAddress.encode('utf8').strip()
            hostName = netutils.getHostName(ipAddress)
        if (not sid) and hostName:
            sid = hostName.upper().split('.')[0]
        if hostName and dbType and port and sid:
            hostName = hostName.strip()
            resolver = netutils.IpResolver('', context.framework)
            dbHostIp = resolver.resolveHostIp(hostName)
            if dbHostIp:
                self.reportTopology(context, dbType, port, sid, dbHostIp)
            else:
                logger.warn('Failed resolving DB host "%s" ip address' %
                            hostName)
        else:
            logger.warn('Failed parsing cmdb config file (datamodel part)')

        hostName = self.getPropertyByRegexp(r'dal\.history\.host\.name=(.+)',
                                            content)
        dbType = self.getPropertyByRegexp(r'dal\.history\.db\.type=(.+)',
                                          content)
        port = self.getPropertyByRegexp(r'dal\.history\.port=(\d+)', content)
        sid = self.getPropertyByRegexp(r'dal\.history\.sid=(\w+)', content)
        if ip_addr.isValidIpAddress(hostName):
            ipAddress = hostName
            ipAddress = ipAddress.encode('utf8').strip()
            hostName = netutils.getHostName(ipAddress)
        if (not sid) and hostName:
            sid = hostName.upper().split('.')[0]
        if hostName and dbType and port and sid:
            hostName = hostName.strip()
            resolver = netutils.IpResolver('', context.framework)
            dbHostIp = resolver.resolveHostIp(hostName)
            if dbHostIp:
                self.reportTopology(context, dbType, port, sid, dbHostIp)
            else:
                logger.warn('Failed resolving DB host "%s" ip address' %
                            hostName)
        else:
            logger.warn('Failed parsing cmdb config file (history part)')
 def __init__(self):
     ConfigBasedPlugin.__init__(self)
     self.allowedProcesses = ['java.exe', 'java', 'javaw.exe']
     self.configPathAndVersionPattern = {'conf/version.txt': r'([0-9,\.]*)'}