Package org.rhq.core.system

Examples of org.rhq.core.system.ProcessInfo$ProcessInfoSnapshot


        String path = pluginConfig.getSimple(ScriptComponent.PATH_CONFIG_PROP).getStringValue();
        String key = buildResourceKey(path, binDir);
        String name = new File(path).getName();
        String version = null;
        String description = null;
        ProcessInfo processInfo = null;
        // noinspection ConstantConditions
        return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, version, description,
            pluginConfig, processInfo);
    }
View Full Code Here


        String path = pluginConfig.getSimple(ScriptComponent.PATH_CONFIG_PROP).getStringValue();
        String key = buildResourceKey(path, homeDir);
        String name = new File(path).getName();
        String version = null;
        String description = null;
        ProcessInfo processInfo = null;
        //noinspection ConstantConditions
        return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, version, description,
            pluginConfig, processInfo);
    }
View Full Code Here

    @Override
    public void upgrade(ResourceUpgradeReport upgradeReport,
        ResourceUpgradeContext<ResourceComponent<?>> inventoriedResource) {

        ProcessInfo processInfo = inventoriedResource.getNativeProcess();

        if (DiscoveryCallbackImpl.isRhqServer(processInfo)) {
            boolean comingFromUpgradeReport = true;
            Configuration pluginConfiguration = upgradeReport.getNewPluginConfiguration();
            if (pluginConfiguration == null) {
View Full Code Here

    private Log log = LogFactory.getLog(DiscoveryCallbackImpl.class);

    @Override
    public DiscoveryCallbackResults discoveredResources(DiscoveredResourceDetails discoveredDetails) throws Exception {

        ProcessInfo processInfo = discoveredDetails.getProcessInfo();
        DiscoveryCallbackResults result = DiscoveryCallbackResults.UNPROCESSED;

        // Do RHQ Server specific work
        if (!isRhqServer(processInfo)) {
            return result;
View Full Code Here

            String prop = process.getEnvironmentVariable("JAVA_OPTS");
            return (null != prop && prop.contains("-Dapp.name=rhq-server"));
        }

        // Windows
        ProcessInfo parentProcess = process.getParentProcess();
        if (null != parentProcess) {
            String commandLine = Arrays.toString(parentProcess.getCommandLine());
            if (null != commandLine && commandLine.contains("rhq-server-wrapper.conf")) {
                return true;
            }
        }
View Full Code Here

        return resources;
    }

    public DiscoveredResourceDetails discoverResource(Configuration pluginConfig,
        ResourceDiscoveryContext discoveryContext) throws InvalidPluginConfigurationException {
        ProcessInfo processInfo = null;
        String jbossHomeDir = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.HOME_DIR)
            .getStringValue();
        JBossInstallationInfo installInfo;
        try {
            installInfo = new JBossInstallationInfo(new File(jbossHomeDir));
View Full Code Here

    private Set<DiscoveredResourceDetails> discoverExternalJBossAsProcesses(ResourceDiscoveryContext discoveryContext) {
        Set<DiscoveredResourceDetails> resources = new HashSet<DiscoveredResourceDetails>();
        List<ProcessScanResult> autoDiscoveryResults = discoveryContext.getAutoDiscoveredProcesses();

        for (ProcessScanResult autoDiscoveryResult : autoDiscoveryResults) {
            ProcessInfo processInfo = autoDiscoveryResult.getProcessInfo();
            if (LOG.isDebugEnabled())
                LOG.debug("Discovered JBoss AS process: " + processInfo);

            JBossInstanceInfo jbossInstanceInfo;
            try {
                jbossInstanceInfo = new JBossInstanceInfo(processInfo);
            } catch (Exception e) {
                LOG.error("Failed to process JBoss AS command line: " + Arrays.asList(processInfo.getCommandLine()), e);
                continue;
            }

            // Skip it if it's an AS/EAP/SOA-P version we don't support.
            JBossInstallationInfo installInfo = jbossInstanceInfo.getInstallInfo();
            if (!isSupportedProduct(installInfo)) {
                continue;
            }

            File installHome = new File(jbossInstanceInfo.getSystemProperties().getProperty(JBossProperties.HOME_DIR));
            File configDir = new File(jbossInstanceInfo.getSystemProperties().getProperty(
                JBossProperties.SERVER_HOME_DIR));

            // The config dir might be a symlink - call getCanonicalFile() to resolve it if so, before
            // calling isDirectory() (isDirectory() returns false for a symlink, even if it points at
            // a directory).
            try {
                if (!configDir.getCanonicalFile().isDirectory()) {
                    LOG.warn("Skipping discovery for JBoss AS process " + processInfo + ", because configuration dir '"
                        + configDir + "' does not exist or is not a directory.");
                    continue;
                }
            } catch (IOException e) {
                LOG.error("Skipping discovery for JBoss AS process " + processInfo + ", because configuration dir '"
                    + configDir + "' could not be canonicalized.", e);
                continue;
            }

            Configuration pluginConfiguration = discoveryContext.getDefaultPluginConfiguration();

            // TODO? Set the connection type - local or remote

            // Set the required props...
            String jnpURL = getJnpURL(jbossInstanceInfo, installHome, configDir);
            PropertySimple namingUrlProp = new PropertySimple(
                ApplicationServerPluginConfigurationProperties.NAMING_URL, jnpURL);
            if (jnpURL == null) {
                namingUrlProp.setErrorMessage("RHQ failed to discover the naming provider URL.");
            }
            pluginConfiguration.put(namingUrlProp);
            pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.HOME_DIR,
                installHome.getAbsolutePath()));
            pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR,
                configDir));

            // Set the optional props...
            pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.SERVER_NAME,
                jbossInstanceInfo.getSystemProperties().getProperty(JBossProperties.SERVER_NAME)));
            pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.BIND_ADDRESS,
                jbossInstanceInfo.getSystemProperties().getProperty(JBossProperties.BIND_ADDRESS)));

            JBossASDiscoveryUtils.UserInfo userInfo = JBossASDiscoveryUtils.getJmxInvokerUserInfo(configDir);
            if (userInfo != null) {
                pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.PRINCIPAL,
                    userInfo.getUsername()));
                pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.CREDENTIALS,
                    userInfo.getPassword()));
            }

            String javaHome = processInfo.getEnvironmentVariable(JAVA_HOME_ENV_VAR);
            if (javaHome == null && LOG.isDebugEnabled()) {
                LOG.warn("Unable to determine the JAVA_HOME environment variable for the JBoss AS process - "
                    + " the Agent is probably running as a user that does not have access to the AS process's "
                    + " environment.");
            }
View Full Code Here

    }

    private void setStartScriptPluginConfigProps(ProcessInfo process, JavaCommandLine commandLine,
        Configuration pluginConfig) {
        StartScriptConfiguration startScriptConfig = new StartScriptConfiguration(pluginConfig);
        ProcessInfo parentProcess = process.getParentProcess();

        File startScript = ServerStartScriptDiscoveryUtility.getStartScript(parentProcess);
        // if we don't discover the start script then leave it empty and the operation code
        // will determine the OS-specific default when needed.
        if (startScript != null) {
View Full Code Here

     * @return resource object describing the Tomcat server running in the specified process
     */
    private DiscoveredResourceDetails parseTomcatProcess(ResourceDiscoveryContext context,
        ProcessScanResult autoDiscoveryResult) {

        ProcessInfo processInfo = autoDiscoveryResult.getProcessInfo();
        String[] commandLine = processInfo.getCommandLine();

        if (!isStandalone(commandLine) && !isWindows(context)) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Ignoring embedded Tomcat instance (catalina.home not found) with following command line: "
                    + Arrays.toString(commandLine));
View Full Code Here

    public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception {

        Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
        for (ProcessScanResult result : ((List<ProcessScanResult>) resourceDiscoveryContext.getAutoDiscoveredProcesses())) {

            ProcessInfo info = result.getProcessInfo();

            // TODO: Add version extraction
            DiscoveredResourceDetails detail =
                new DiscoveredResourceDetails(resourceDiscoveryContext.getResourceType(), "sshd", "OpenSSH sshd", "1.0",
                    "Open SSH Daemon " + info.getName(), null, null);

            details.add(detail);
        }

        return details;
View Full Code Here

TOP

Related Classes of org.rhq.core.system.ProcessInfo$ProcessInfoSnapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.