jmsTopologyReporter = jms.EnhancedTopologyReporter(jms.TopologyBuilder()) else: logger.info("Reporting of enhanced JEE topology disabled") serverTopologyReporter = jee.ServerTopologyReporter(weblogic.ServerTopologyBuilder()) applicationReporter = jee.ApplicationTopologyReporter(jee.ApplicationTopologyBuilder()) datasourceTopologyReporter = jee.DatasourceTopologyReporter( jee.DatasourceTopologyBuilder(), dnsResolver ) jmsTopologyReporter = jms.TopologyReporter(jms.TopologyBuilder()) try: jmxProvider = jmx.Provider(client) # create platform trait based on server version platformTrait = jee_discoverer.getPlatformTrait(version, platform) serverDiscoverer = weblogic_discoverer.createServerDiscovererByJmx(jmxProvider, platformTrait) appDiscoverer = weblogic_discoverer.createApplicationDiscovererByJmx(jmxProvider, platformTrait) jmsDiscoverer = weblogic_discoverer.createJmsDiscovererByJmx(jmxProvider, platformTrait) # DOMAIN TOPOLOGY DISCOVERY logger.info("Start domain topology discovery") domain = serverDiscoverer.discoverRunningServersInDomain() if not domain: Framework.reportError("Failed to find domain information") return # set administrative IP address for the domain # next step to find domain administrative IP address, which is actually admin-server IP import iteratortools allservers = iteratortools.flatten( map(jee.Node.getServers, domain.getNodes()) )
jms.TopologyBuilder()) else: logger.info("Reporting of enhanced JEE topology disabled") serverTopologyReporter = jee.ServerTopologyReporter( weblogic.ServerTopologyBuilder()) applicationReporter = jee.ApplicationTopologyReporter( jee.ApplicationTopologyBuilder()) datasourceTopologyReporter = jee.DatasourceTopologyReporter( jee.DatasourceTopologyBuilder(), dnsResolver) jmsTopologyReporter = jms.TopologyReporter(jms.TopologyBuilder()) try: jmxProvider = jmx.Provider(client) # create platform trait based on server version platformTrait = jee_discoverer.getPlatformTrait(version, platform) serverDiscoverer = weblogic_discoverer.createServerDiscovererByJmx( jmxProvider, platformTrait) appDiscoverer = weblogic_discoverer.createApplicationDiscovererByJmx( jmxProvider, platformTrait) jmsDiscoverer = weblogic_discoverer.createJmsDiscovererByJmx( jmxProvider, platformTrait) # DOMAIN TOPOLOGY DISCOVERY logger.info("Start domain topology discovery") domain = serverDiscoverer.discoverRunningServersInDomain() if not domain: Framework.reportError("Failed to find domain information") return # set administrative IP address for the domain # next step to find domain administrative IP address, which is actually admin-server IP
try: domainDescriptorFile = domainLayout.getFileContent( domainLayout.getDomainConfigFilePath() ) domainDescriptor = parser.parseConfiguration(domainDescriptorFile.content) except (Exception, JException): logger.warnException("Failed to process config.xml") continue # get version of the platform # this covers descriptor XML structure for two major versions versionInfo = domainDescriptor.versionInfo logger.info("Platform version is %s" % versionInfo) # create corresponding platform trait, based on version information platformTrait = jee_discoverer.getPlatformTrait(versionInfo, platform, fallbackVersion = 9) # create runtime instances for each process runtimes = map(curry(weblogic_discoverer.createServerRuntimeByProcess, _, destinationIp ), processes ) # create catalog of runtimes by server names # it will be used to get more data overridden by command line runtimeByServerName = applyMapping(weblogic_discoverer.ServerRuntime.findServerName, runtimes) # processes of managed servers may contain URI to the administrative # server, gathering such information may help in further server # address resovling
netutils.JavaDnsResolver(), client.getIpAddress() #TODO: change to ip ) # Create reporters depending on enableJeeEnhancedTopology value in the global settings globalSettings = GeneralSettingsConfigFile.getInstance() loadExternalDTD = globalSettings.getPropertyBooleanValue('loadExternalDTD', 0) descrParser = jee_discoverer.ApplicationDescriptorParser(loadExternalDTD) reporterCreator = jee_discoverer.createTopologyReporterFactory(jboss.TopologyBuilder(), dnsResolver) domainTopologyReporter = reporterCreator.getDomainReporter() jmsTopologyReporter = reporterCreator.getJmsDsReporter() datasourceTopologyReporter = reporterCreator.getJdbcDsReporter() applicationReporter = reporterCreator.getApplicationReporter() # create corresponding discoverer by version and get domain info: domain = None platformTrait = jee_discoverer.getPlatformTrait(version, platform, fallbackVersion = 4) if platformTrait.majorVersion.value() >= 7: # JBoss version 7+ try: serverDiscoverer = jboss_discoverer.ServerDiscovererByJmxV7(jmxProvider) #TODO: fill hostControllerManagementPort from AppSignature, job-param, or inputTQL domain = serverDiscoverer.discoverDomain(hostControllerManagementPort = '9999') except (Exception, JException): logger.debugException('Failed to discover domain') else: # JBoss version 4-6 serverDiscoverer = jboss_discoverer.ServerDiscovererByJmx(jmxProvider) domain = serverDiscoverer.discoverDomain() #TODO: add support remote domainController domain.setIp(ip.value()) for node in domain.getNodes(): # process servers in nodes (usually one) # discover JVMS for all servers