Search in sources :

Example 1 with SSOServerMonConfig

use of com.sun.identity.monitoring.SSOServerMonConfig in project OpenAM by OpenRock.

the class ConfigMonitoring method getMonServiceAttrs.

private int getMonServiceAttrs() {
    String classMethod = "ConfigMonitoring.getMonServiceAttrs: ";
    try {
        ServiceSchemaManager schemaManager = new ServiceSchemaManager("iPlanetAMMonitoringService", ssoToken);
        ServiceSchema smsMonSchema = schemaManager.getGlobalSchema();
        Map monAttrs = smsMonSchema.getAttributeDefaults();
        boolean monEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-enabled")).booleanValue();
        if (!monEna) {
            if (debug.warningEnabled()) {
                debug.warning(classMethod + "monitoring is disabled");
            }
            return -1;
        }
        boolean httpEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-http-enabled")).booleanValue();
        int httpPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-http-port"));
        String authFilePath = CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-authfile-path");
        int rmiPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-rmi-port"));
        boolean rmiEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-rmi-enabled")).booleanValue();
        int snmpPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-snmp-port"));
        boolean snmpEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-snmp-enabled")).booleanValue();
        int policyWindow = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-policy-window"));
        int sessionWindow = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-session-window"));
        if (debug.messageEnabled()) {
            debug.message(classMethod + "\n" + "     monitoring enabled = " + monEna + "\n" + "     monitoring auth filepath = " + authFilePath + "\n" + "     httpPort = " + httpPort + "\n" + "     httpPort enabled = " + httpEna + "\n" + "     rmiPort = " + rmiPort + "\n" + "     rmiPort enabled = " + rmiEna + "\n" + "     snmpPort = " + snmpPort + "\n" + "     snmpPort enabled = " + snmpEna + "\n" + "     policy eval window size = " + policyWindow + "\n" + "     session eval window size = " + sessionWindow + "\n");
        }
        SSOServerMonConfig sMonInfo = new SSOServerMonConfig.SSOServerMonInfoBuilder(monEna).htmlPort(httpPort).htmlAuthFile(authFilePath).snmpPort(snmpPort).rmiPort(rmiPort).monHtmlEnabled(httpEna).monRmiEnabled(rmiEna).monSnmpEnabled(snmpEna).policyWindowSize(policyWindow).sessionWindowSize(sessionWindow).build();
        int i = Agent.startAgent(sMonInfo);
        if (i != 0) {
            if (debug.warningEnabled()) {
                debug.warning(classMethod + "Monitoring Agent not started (" + i + ")");
            }
            return (i);
        }
    } catch (Exception ex) {
        debug.error(classMethod + "error reading Monitoring attributes: ", ex);
        return (Agent.MON_READATTRS_PROBLEM);
    }
    return 0;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOServerMonConfig(com.sun.identity.monitoring.SSOServerMonConfig) HashMap(java.util.HashMap) Map(java.util.Map) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) IdRepoException(com.sun.identity.idm.IdRepoException) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException)

Aggregations

SSOException (com.iplanet.sso.SSOException)1 AMConfigurationException (com.sun.identity.authentication.config.AMConfigurationException)1 IdRepoException (com.sun.identity.idm.IdRepoException)1 SSOServerMonConfig (com.sun.identity.monitoring.SSOServerMonConfig)1 SMSException (com.sun.identity.sm.SMSException)1 ServiceSchema (com.sun.identity.sm.ServiceSchema)1 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1