Search in sources :

Example 1 with UnsupportedReadingException

use of com.axway.ats.core.monitoring.UnsupportedReadingException in project ats-framework by Axway.

the class MatchedProcess method createStaticReadingInstances.

public static List<ReadingInstance> createStaticReadingInstances(ISystemInformation systemInfo, List<ReadingBean> readings) throws UnsupportedReadingException, SystemInformationException {
    List<ReadingInstance> readingInstances = new ArrayList<ReadingInstance>();
    // ADD SYSTEM READINGS
    for (ReadingBean reading : readings) {
        String readingName = reading.getName();
        ReadingInstance readingInstance = null;
        if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__TOTAL)) {
            readingInstance = getSwapTotal(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__USED)) {
            readingInstance = getSwapUsed(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__FREE)) {
            readingInstance = getSwapFree(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__PAGES_IN)) {
            readingInstance = getSwapPagesIn(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_VIRTUAL_MEMORY__PAGES_OUT)) {
            readingInstance = getSwapPagesOut(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__USED)) {
            readingInstance = getMemoryUsed(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__FREE)) {
            readingInstance = getMemoryFree(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__ACTUAL_USED)) {
            readingInstance = getMemoryActualUsed(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_MEMORY__ACTUAL_FREE)) {
            readingInstance = getMemoryActualFree(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_IO__READ_BYTES_ALL_DEVICES)) {
            readingInstance = getReadBytesAllLocalDevices(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_IO__WRITE_BYTES_ALL_DEVICES)) {
            readingInstance = getWriteBytesAllLocalDevices(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_LOAD__LAST_MINUTE)) {
            if (!IS_WINDOWS) {
                readingInstance = getLoadAverage1minute(systemInfo, reading);
            }
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_LOAD__LAST_5_MINUTES)) {
            if (!IS_WINDOWS) {
                readingInstance = getLoadAverage5minutes(systemInfo, reading);
            }
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_LOAD__LAST_15_MINUTES)) {
            if (!IS_WINDOWS) {
                readingInstance = getLoadAverage15minutes(systemInfo, reading);
            }
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__TOTAL)) {
            readingInstance = getCpuUsageTotal(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__WAIT)) {
            readingInstance = getCpuUsageWaitingForIO(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__KERNEL)) {
            readingInstance = getCpuUsageRunningKernelCode(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_CPU_USAGE__USER)) {
            readingInstance = getCpuUsageRunningUserCode(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETWORK_TRAFFIC)) {
            List<ReadingInstance> readingsList = getNetworkTraffic(systemInfo, reading);
            readingInstances.addAll(readingsList);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__ACTIVE_CONNECTION_OPENINGS)) {
            readingInstance = getNetstatActiveConnectionOpenings(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__PASSIVE_CONNECTION_OPENINGS)) {
            readingInstance = getNetstatPassiveConnectionOpenings(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__FAILED_CONNECTION_ATTEMPTS)) {
            readingInstance = getNetstatFailedConnectionAttemtps(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__RESET_CONNECTIONS)) {
            readingInstance = getNetstatResetConnections(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__CURRENT_CONNECTIONS)) {
            readingInstance = getNetstatCurrentConnections(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__SEGMENTS_RECEIVED)) {
            readingInstance = getNetstatSegmentsReceived(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__SEGMENTS_SENT)) {
            readingInstance = getNetstatSegmentsSent(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__SEGMENTS_RETRANSMITTED)) {
            readingInstance = getNetstatSegmentsRetransmitter(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__OUT_RESETS)) {
            readingInstance = getNetstatOutResets(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_NETSTAT__IN_ERRORS)) {
            readingInstance = getNetstatInErrors(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__CLOSE)) {
            readingInstance = getTcpClose(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__LISTEN)) {
            readingInstance = getTcpListen(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__SYN_SENT)) {
            readingInstance = getTcpSynSent(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__SYN_RECEIVED)) {
            readingInstance = getTcpSynReceived(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__ESTABLISHED)) {
            readingInstance = getTcpEstablished(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__CLOSE_WAIT)) {
            readingInstance = getTcpCloseWait(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__LAST_ACK)) {
            readingInstance = getTcpLastAck(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__FIN_WAIT1)) {
            readingInstance = getTcpFinWait1(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__FIN_WAIT2)) {
            readingInstance = getTcpFinWait2(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__CLOSING)) {
            readingInstance = getTcpClosing(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__TIME_WAIT)) {
            readingInstance = getTcpTimeWait(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__BOUND)) {
            readingInstance = getTcpBound(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__IDLE)) {
            readingInstance = getTcpIdle(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__TOTAL_INBOUND)) {
            readingInstance = getTcpTotalInbound(systemInfo, reading);
        } else if (readingName.equalsIgnoreCase(SystemMonitorDefinitions.READING_TCP__TOTAL_OUTBOUND)) {
            readingInstance = getTcpTotalOutbound(systemInfo, reading);
        } else {
            throw new UnsupportedReadingException(readingName);
        }
        if (readingInstance != null) {
            readingInstances.add(readingInstance);
        }
    }
    return readingInstances;
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) ParentProcessReadingBean(com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean) UnsupportedReadingException(com.axway.ats.core.monitoring.UnsupportedReadingException) ArrayList(java.util.ArrayList)

Example 2 with UnsupportedReadingException

use of com.axway.ats.core.monitoring.UnsupportedReadingException in project ats-framework by Axway.

the class AtsJvmMonitor method createReadingInstances.

private void createReadingInstances(ReadingBean[] readings) throws UnsupportedReadingException {
    readingInstances = new ArrayList<JvmReadingInstance>();
    for (ReadingBean 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);
    }
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) UnsupportedReadingException(com.axway.ats.core.monitoring.UnsupportedReadingException)

Aggregations

ReadingBean (com.axway.ats.common.performance.monitor.beans.ReadingBean)2 UnsupportedReadingException (com.axway.ats.core.monitoring.UnsupportedReadingException)2 ParentProcessReadingBean (com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean)1 ArrayList (java.util.ArrayList)1