use of com.axway.ats.agent.components.monitoring.model.exceptions.UnsupportedReadingException in project ats-framework by Axway.
the class AtsJvmMonitor method createReadingInstances.
private void createReadingInstances(FullReadingBean[] readings) throws UnsupportedReadingException {
readingInstances = new ArrayList<JvmReadingInstance>();
for (FullReadingBean reading : readings) {
String readingName = reading.getName();
JvmReadingInstance readingInstance = null;
if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__CPU_USAGE)) {
readingInstance = getCpuUsage(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__MEMORY_HEAP)) {
readingInstance = getHeap(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__MEMORY_HEAP_YOUNG_GENERATION_EDEN)) {
readingInstance = getHeapEden(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__MEMORY_HEAP_YOUNG_GENERATION_SURVIVOR)) {
readingInstance = getHeapSurvivor(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__MEMORY_HEAP_OLD_GENERATION)) {
readingInstance = getHeapOldGen(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__MEMORY_PERMANENT_GENERATION)) {
readingInstance = getHeapPermGen(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__MEMORY_CODE_CACHE)) {
readingInstance = getHeapCodeCache(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__CLASSES_COUNT)) {
readingInstance = getClassesCount(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__THREADS_COUNT)) {
readingInstance = getThreadsCount(connection, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_JVM__THREADS_DAEMON_COUNT)) {
readingInstance = getDaemonThreadsCount(connection, reading);
} else if (!StringUtils.isNullOrEmpty(reading.getParameter("MBEAN_NAME"))) {
readingInstance = getCustomMBeanProperty(connection, reading);
} else {
throw new UnsupportedReadingException(readingName);
}
readingInstances.add(readingInstance);
}
}
use of com.axway.ats.agent.components.monitoring.model.exceptions.UnsupportedReadingException in project ats-framework by Axway.
the class MatchedProcess method createStaticReadingInstances.
public static List<ReadingInstance> createStaticReadingInstances(SigarWrapper sigarWrapper, List<FullReadingBean> readings) throws UnsupportedReadingException, SigarException {
List<ReadingInstance> readingInstances = new ArrayList<ReadingInstance>();
// ADD SYSTEM READINGS
for (FullReadingBean reading : readings) {
String readingName = reading.getName();
ReadingInstance readingInstance = null;
if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__TOTAL)) {
readingInstance = getSwapTotal(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__USED)) {
readingInstance = getSwapUsed(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__FREE)) {
readingInstance = getSwapFree(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__PAGES_IN)) {
readingInstance = getSwapPagesIn(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__PAGES_OUT)) {
readingInstance = getSwapPagesOut(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__USED)) {
readingInstance = getMemoryUsed(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__FREE)) {
readingInstance = getMemoryFree(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__ACTUAL_USED)) {
readingInstance = getMemoryActualUsed(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__ACTUAL_FREE)) {
readingInstance = getMemoryActualFree(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_IO__READ_BYTES_ALL_DEVICES)) {
readingInstance = getReadBytesAllLocalDevices(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_IO__WRITE_BYTES_ALL_DEVICES)) {
readingInstance = getWriteBytesAllLocalDevices(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_LOAD__LAST_MINUTE)) {
if (!IS_WINDOWS) {
readingInstance = getLoadAverage1minute(sigarWrapper, reading);
}
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_LOAD__LAST_5_MINUTES)) {
if (!IS_WINDOWS) {
readingInstance = getLoadAverage5minutes(sigarWrapper, reading);
}
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_LOAD__LAST_15_MINUTES)) {
if (!IS_WINDOWS) {
readingInstance = getLoadAverage15minutes(sigarWrapper, reading);
}
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__TOTAL)) {
readingInstance = getCpuUsageTotal(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__WAIT)) {
readingInstance = getCpuUsageWaitingForIO(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__KERNEL)) {
readingInstance = getCpuUsageRunningKernelCode(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__USER)) {
readingInstance = getCpuUsageRunningUserCode(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETWORK_TRAFFIC)) {
List<ReadingInstance> readingsList = getNetworkTraffic(sigarWrapper, reading);
readingInstances.addAll(readingsList);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__ACTIVE_CONNECTION_OPENINGS)) {
readingInstance = getNetstatActiveConnectionOpenings(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__PASSIVE_CONNECTION_OPENINGS)) {
readingInstance = getNetstatPassiveConnectionOpenings(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__FAILED_CONNECTION_ATTEMPTS)) {
readingInstance = getNetstatFailedConnectionAttemtps(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__RESET_CONNECTIONS)) {
readingInstance = getNetstatResetConnections(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__CURRENT_CONNECTIONS)) {
readingInstance = getNetstatCurrentConnections(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__SEGMENTS_RECEIVED)) {
readingInstance = getNetstatSegmentsReceived(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__SEGMENTS_SENT)) {
readingInstance = getNetstatSegmentsSent(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__SEGMENTS_RETRANSMITTED)) {
readingInstance = getNetstatSegmentsRetransmitter(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__OUT_RESETS)) {
readingInstance = getNetstatOutResets(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__IN_ERRORS)) {
readingInstance = getNetstatInErrors(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__CLOSE)) {
readingInstance = getTcpClose(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__LISTEN)) {
readingInstance = getTcpListen(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__SYN_SENT)) {
readingInstance = getTcpSynSent(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__SYN_RECEIVED)) {
readingInstance = getTcpSynReceived(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__ESTABLISHED)) {
readingInstance = getTcpEstablished(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__CLOSE_WAIT)) {
readingInstance = getTcpCloseWait(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__LAST_ACK)) {
readingInstance = getTcpLastAck(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__FIN_WAIT1)) {
readingInstance = getTcpFinWait1(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__FIN_WAIT2)) {
readingInstance = getTcpFinWait2(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__CLOSING)) {
readingInstance = getTcpClosing(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__TIME_WAIT)) {
readingInstance = getTcpTimeWait(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__BOUND)) {
readingInstance = getTcpBound(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__IDLE)) {
readingInstance = getTcpIdle(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__TOTAL_INBOUND)) {
readingInstance = getTcpTotalInbound(sigarWrapper, reading);
} else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__TOTAL_OUTBOUND)) {
readingInstance = getTcpTotalOutbound(sigarWrapper, reading);
} else {
throw new UnsupportedReadingException(readingName);
}
if (readingInstance != null) {
readingInstances.add(readingInstance);
}
}
return readingInstances;
}
Aggregations