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;
}
Aggregations