Search in sources :

Example 1 with PerformanceMonitor

use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.

the class AtsSystemMonitoringAgent method resetTheMonitoringAgent.

public void resetTheMonitoringAgent() {
    for (PerformanceMonitor monitor : monitors) {
        log.info("Deinitializing monitor: " + monitor.getDescription());
        try {
            monitor.deinit();
        } catch (Exception e) {
            log.error("Error deinitializing monitor: " + monitor.getDescription(), e);
        }
    }
    this.monitors = new ArrayList<PerformanceMonitor>();
    this.pollErrors = new HashMap<String, Integer>();
}
Also used : PerformanceMonitor(com.axway.ats.common.performance.monitor.PerformanceMonitor) DatabaseAccessException(com.axway.ats.log.autodb.exceptions.DatabaseAccessException) MonitoringException(com.axway.ats.core.monitoring.MonitoringException)

Example 2 with PerformanceMonitor

use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.

the class InternalSystemMonitoringOperations method initializeMonitor.

private void initializeMonitor(String monitorClassName, List<FullReadingBean> readings, int pollInterval) throws MonitorConfigurationException {
    // try to make an instance of the monitor class
    Object monitorInstance;
    try {
        monitorInstance = Class.forName(monitorClassName).newInstance();
    } catch (InstantiationException e) {
        throw new MonitorConfigurationException("InstantiationException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
    } catch (IllegalAccessException e) {
        throw new MonitorConfigurationException("IllegalAccessException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
    } catch (ClassNotFoundException e) {
        throw new MonitorConfigurationException("ClassNotFoundException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
    }
    // check if it implements the needed interface
    if (!(monitorInstance instanceof PerformanceMonitor)) {
        throw new MonitorConfigurationException(monitorClassName + " is not a valid monitor class");
    }
    PerformanceMonitor monitor = (PerformanceMonitor) monitorInstance;
    try {
        // initialize the monitor
        monitor.setPollInterval(pollInterval);
        monitor.init(readings.toArray(new FullReadingBean[readings.size()]));
    } catch (Throwable e) {
        throw new MonitorConfigurationException("Error initializing " + monitorClassName + " monitor: " + e.getMessage(), e);
    }
    monitoringAgent.addMonitor(monitor);
}
Also used : MonitorConfigurationException(com.axway.ats.agent.components.monitoring.model.exceptions.MonitorConfigurationException) PerformanceMonitor(com.axway.ats.common.performance.monitor.PerformanceMonitor) FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean)

Example 3 with PerformanceMonitor

use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.

the class AtsSystemMonitoringAgent method resetTheMonitoringAgent.

public void resetTheMonitoringAgent() {
    for (PerformanceMonitor monitor : monitors) {
        log.info("Deinitializing monitor: " + monitor.getDescription());
        try {
            monitor.deinit();
        } catch (Exception e) {
            log.error("Error deinitializing monitor: " + monitor.getDescription(), e);
        }
    }
    this.monitors = new ArrayList<PerformanceMonitor>();
    this.pollErrors = new HashMap<String, Integer>();
    synchronized (collectedResults) {
        this.collectedResults.clear();
    }
}
Also used : PerformanceMonitor(com.axway.ats.common.performance.monitor.PerformanceMonitor)

Example 4 with PerformanceMonitor

use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.

the class AgentSystemMonitor method initializeMonitor.

private void initializeMonitor(String monitorClassName, List<ReadingBean> readings, int pollInterval) throws MonitorConfigurationException {
    // try to make an instance of the monitor class
    Object monitorInstance;
    try {
        monitorInstance = Class.forName(monitorClassName).newInstance();
    } catch (InstantiationException e) {
        throw new MonitorConfigurationException("InstantiationException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
    } catch (IllegalAccessException e) {
        throw new MonitorConfigurationException("IllegalAccessException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
    } catch (ClassNotFoundException e) {
        throw new MonitorConfigurationException("ClassNotFoundException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
    }
    // check if it implements the needed interface
    if (!(monitorInstance instanceof PerformanceMonitor)) {
        throw new MonitorConfigurationException(monitorClassName + " is not a valid monitor class");
    }
    PerformanceMonitor monitor = (PerformanceMonitor) monitorInstance;
    try {
        // initialize the monitor
        monitor.setPollInterval(pollInterval);
        monitor.init(readings.toArray(new ReadingBean[readings.size()]));
    } catch (Throwable e) {
        throw new MonitorConfigurationException("Error initializing " + monitorClassName + " monitor: " + e.getMessage(), e);
    }
    monitoringAgent.addMonitor(monitor);
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) MonitorConfigurationException(com.axway.ats.core.monitoring.MonitorConfigurationException) PerformanceMonitor(com.axway.ats.common.performance.monitor.PerformanceMonitor)

Aggregations

PerformanceMonitor (com.axway.ats.common.performance.monitor.PerformanceMonitor)4 MonitorConfigurationException (com.axway.ats.agent.components.monitoring.model.exceptions.MonitorConfigurationException)1 FullReadingBean (com.axway.ats.common.performance.monitor.beans.FullReadingBean)1 ReadingBean (com.axway.ats.common.performance.monitor.beans.ReadingBean)1 MonitorConfigurationException (com.axway.ats.core.monitoring.MonitorConfigurationException)1 MonitoringException (com.axway.ats.core.monitoring.MonitoringException)1 DatabaseAccessException (com.axway.ats.log.autodb.exceptions.DatabaseAccessException)1