use of com.axway.ats.common.performance.monitor.beans.FullReadingBean in project ats-framework by Axway.
the class SystemMonitor method scheduleJvmMonitoring.
/**
* Schedule monitoring a JVM application
* <br><b>Note:</b> You must open the tested JVM application for JMX connections by adding the following
* runtime properties:
* "-Dcom.sun.management.jmxremote.port=[PORT NUMBER] -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
*
* @param monitoredHost the host where the monitored application is
* @param jvmPort the JMX port which is used for monitoring the JVM application
* @param alias the alias to use when logging into the database
* @param jvmReadingTypes what kind of data to collect. Use some of the SystemMonitor.MONITOR_JVM_* constants
*/
@PublicAtsApi
public void scheduleJvmMonitoring(@Validate(name = "monitoredHost", type = ValidationType.STRING_SERVER_WITH_PORT) String monitoredHost, @Validate(name = "jvmPort", type = ValidationType.NUMBER_PORT_NUMBER) String jvmPort, @Validate(name = "alias", type = ValidationType.NOT_NULL) String alias, @Validate(name = "jvmReadingTypes", type = ValidationType.NOT_NULL) String[] jvmReadingTypes) {
// validate input parameters
monitoredHost = HostUtils.getAtsAgentIpAndPort(monitoredHost);
new Validator().validateMethodParameters("Could not schedule monitoring JVM statistics on '" + monitoredHost + "' at " + jvmPort + " port", new Object[] { monitoredHost, jvmPort, jvmReadingTypes });
Set<FullReadingBean> readingTypes = requestedReadingTypesPerHosts.get(monitoredHost);
if (readingTypes == null) {
readingTypes = new HashSet<FullReadingBean>();
}
Map<String, String> readingParameters = new HashMap<String, String>();
readingParameters.put("JMX_PORT", jvmPort);
if (!StringUtils.isNullOrEmpty(alias)) {
readingParameters.put(SystemMonitorDefinitions.PARAMETER_NAME__PROCESS_ALIAS, alias);
}
for (String readingType : jvmReadingTypes) {
FullReadingBean reading = ReadingsRepository.getInstance().getReadingXmlDefinition(readingType, readingParameters);
readingTypes.add(reading);
}
requestedReadingTypesPerHosts.put(monitoredHost, readingTypes);
monitoredHosts.add(monitoredHost);
}
use of com.axway.ats.common.performance.monitor.beans.FullReadingBean in project ats-framework by Axway.
the class SystemMonitor method initializeSystemMonitoringProcess.
private void initializeSystemMonitoringProcess(String monitoredHost, Set<FullReadingBean> readings) throws MonitoringException {
log.debug("Initializing the system monitoring process on " + monitoredHost);
try {
InternalSystemMonitoringOperations sysMonitoringActions = new InternalSystemMonitoringOperations(monitoredHost);
sysMonitoringActions.initializeMonitoring(new ArrayList<FullReadingBean>(readings), startTimestamp, pollInterval);
} catch (AgentException e) {
throw new MonitoringException("Could not start the system monitoring process on " + monitoredHost + ". For more details check loader logs on that machine", e);
}
}
use of com.axway.ats.common.performance.monitor.beans.FullReadingBean in project ats-framework by Axway.
the class ReadingsRepository method extractReading.
/**
* Extracts all the data for a given monitor by iterating over it's filters
*
* @param element the root element of the tree
* @throws MonitorConfigurationException
*/
private void extractReading(Element readingLevelElement, String monitorClass) throws MonitorConfigurationException {
String readingName = extractAttribute(readingLevelElement, READING_NODE__NAME);
if (readingName == null) {
this.readingParseState.throwException("No reading name specified");
}
this.readingParseState.rememberReadingName(readingName);
String readingUnit = extractAttribute(readingLevelElement, READING_NODE__UNIT);
if (readingUnit == null) {
this.readingParseState.throwException("No reading unit specified");
}
boolean dynamicReadingValue = false;
String dynamicReading = extractAttribute(readingLevelElement, READING_NODE__DYNAMIC);
if (dynamicReading != null && "true".equals(dynamicReading.trim())) {
dynamicReadingValue = true;
}
FullReadingBean readingBean = new FullReadingBean(monitorClass, readingName, readingUnit);
readingBean.setDynamicReading(dynamicReadingValue);
this.xmlRepository.addReading(readingName, readingBean);
// inform the user what we got
log.debug(readingBean.getDescription());
this.readingParseState.forgetReadingName();
}
Aggregations