Search in sources :

Example 16 with FullReadingBean

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);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 17 with FullReadingBean

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);
    }
}
Also used : InternalSystemMonitoringOperations(com.axway.ats.agent.components.monitoring.operations.clients.InternalSystemMonitoringOperations) AgentException(com.axway.ats.agent.core.exceptions.AgentException) MonitoringException(com.axway.ats.monitoring.model.exceptions.MonitoringException) FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean)

Example 18 with FullReadingBean

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();
}
Also used : FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean)

Aggregations

FullReadingBean (com.axway.ats.common.performance.monitor.beans.FullReadingBean)18 ArrayList (java.util.ArrayList)7 PublicAtsApi (com.axway.ats.common.PublicAtsApi)4 HashMap (java.util.HashMap)4 ParentProcessReadingBean (com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean)3 Validator (com.axway.ats.core.validation.Validator)3 MonitoringException (com.axway.ats.monitoring.model.exceptions.MonitoringException)3 HashSet (java.util.HashSet)3 UnsupportedReadingException (com.axway.ats.agent.components.monitoring.model.exceptions.UnsupportedReadingException)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 SigarException (org.hyperic.sigar.SigarException)2 AtsSystemMonitoringAgent (com.axway.ats.agent.components.monitoring.model.agents.AtsSystemMonitoringAgent)1 MonitorConfigurationException (com.axway.ats.agent.components.monitoring.model.exceptions.MonitorConfigurationException)1 InternalSystemMonitoringOperations (com.axway.ats.agent.components.monitoring.operations.clients.InternalSystemMonitoringOperations)1 AgentException (com.axway.ats.agent.core.exceptions.AgentException)1 Action (com.axway.ats.agent.core.model.Action)1 PerformanceMonitor (com.axway.ats.common.performance.monitor.PerformanceMonitor)1 BasicReadingBean (com.axway.ats.common.performance.monitor.beans.BasicReadingBean)1 DbAccessFactory (com.axway.ats.log.autodb.DbAccessFactory)1