Search in sources :

Example 1 with AtsSystemMonitoringAgent

use of com.axway.ats.agent.core.monitoring.agents.AtsSystemMonitoringAgent in project ats-framework by Axway.

the class AgentSystemMonitor method initializeMonitoring.

public void initializeMonitoring(List<ReadingBean> readings, int pollInterval, long executorTimeOffset) {
    monitoringAgent = new AtsSystemMonitoringAgent(pollInterval, executorTimeOffset);
    if (pollInterval < 1) {
        throw new MonitoringException("The interval for collecting statistical data must be at least 1 second. You have specified " + pollInterval + " seconds");
    }
    Map<String, List<ReadingBean>> readingsPerMonitor = new HashMap<String, List<ReadingBean>>();
    // load all the monitors and initialize them
    for (ReadingBean reading : readings) {
        List<ReadingBean> readingsForThisMonitor = readingsPerMonitor.get(reading.getMonitorName());
        if (readingsForThisMonitor == null) {
            readingsForThisMonitor = new ArrayList<ReadingBean>();
            readingsPerMonitor.put(reading.getMonitorName(), readingsForThisMonitor);
        }
        readingsForThisMonitor.add(reading);
    }
    for (String monitorClassName : readingsPerMonitor.keySet()) {
        initializeMonitor(monitorClassName, readingsPerMonitor.get(monitorClassName), pollInterval);
    }
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) HashMap(java.util.HashMap) MonitoringException(com.axway.ats.core.monitoring.MonitoringException) ArrayList(java.util.ArrayList) List(java.util.List) AtsSystemMonitoringAgent(com.axway.ats.agent.core.monitoring.agents.AtsSystemMonitoringAgent)

Aggregations

AtsSystemMonitoringAgent (com.axway.ats.agent.core.monitoring.agents.AtsSystemMonitoringAgent)1 ReadingBean (com.axway.ats.common.performance.monitor.beans.ReadingBean)1 MonitoringException (com.axway.ats.core.monitoring.MonitoringException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1