@Test public void testGetNodeNetworkInfoFunction() { assertEquals(ArrayList.class, provider.getNodeNetworkInfos().getClass()); assert(provider.getNodeNetworkInfos() != null); }
public List<Map<Object, Object>> getNodeNetworkInfos() { List<Map<Object, Object>> nodeNetworkInfoList = new ArrayList<Map<Object, Object>>(); Map<Object, Object> nodeNetworkInfo = null; String[] netInterfaceList = null; NetInterfaceStat netInterfaceStat = null; try { netInterfaceList = sigar.getNetInterfaceList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (String netInterface : netInterfaceList) { try { netInterfaceStat = sigar.getNetInterfaceStat(netInterface); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } nodeNetworkInfo = new HashMap<Object, Object>(); nodeNetworkInfo.put("interfaceName", netInterface); nodeNetworkInfo.put("receivedBytes", netInterfaceStat.getRxBytes()); nodeNetworkInfo.put("receivedDropped", netInterfaceStat.getRxDropped()); nodeNetworkInfo.put("receivedErrors", netInterfaceStat.getRxErrors()); nodeNetworkInfo.put("receivedFrame", netInterfaceStat.getRxFrame()); nodeNetworkInfo.put("receivedOverruns", netInterfaceStat.getRxOverruns()); nodeNetworkInfo.put("receivedPackets", netInterfaceStat.getRxPackets()); nodeNetworkInfo.put("transmittedBytes", netInterfaceStat.getTxBytes()); nodeNetworkInfo.put("transmittedDropped", netInterfaceStat.getTxDropped()); nodeNetworkInfo.put("transmittedErrors", netInterfaceStat.getTxErrors()); nodeNetworkInfo.put("transmittedCarrier", netInterfaceStat.getTxCarrier()); nodeNetworkInfo.put("transmittedCollision", netInterfaceStat.getTxCollisions()); nodeNetworkInfo.put("transmittedOverruns", netInterfaceStat.getTxOverruns()); nodeNetworkInfo.put("transmittedPackets", netInterfaceStat.getTxPackets()); nodeNetworkInfo.put("speed", netInterfaceStat.getSpeed()); nodeNetworkInfoList.add(nodeNetworkInfo); } return nodeNetworkInfoList; }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeNetworkInfos() { List<Map<Object, Object>> nodeNetworkInfoList = new ArrayList<Map<Object, Object>>(); Map<Object, Object> nodeNetworkInfo = null; String[] netInterfaceList = null; NetInterfaceStat netInterfaceStat = null; try { netInterfaceList = sigar.getNetInterfaceList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (String netInterface : netInterfaceList) { try { netInterfaceStat = sigar.getNetInterfaceStat(netInterface); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } nodeNetworkInfo = new HashMap<Object, Object>(); nodeNetworkInfo.put("interfaceName", netInterface); nodeNetworkInfo.put("receivedBytes", netInterfaceStat.getRxBytes()); nodeNetworkInfo.put("receivedDropped", netInterfaceStat.getRxDropped()); nodeNetworkInfo.put("receivedErrors", netInterfaceStat.getRxErrors()); nodeNetworkInfo.put("receivedFrame", netInterfaceStat.getRxFrame()); nodeNetworkInfo.put("receivedOverruns", netInterfaceStat.getRxOverruns()); nodeNetworkInfo.put("receivedPackets", netInterfaceStat.getRxPackets()); nodeNetworkInfo.put("transmittedBytes", netInterfaceStat.getTxBytes()); nodeNetworkInfo.put("transmittedDropped", netInterfaceStat.getTxDropped()); nodeNetworkInfo.put("transmittedErrors", netInterfaceStat.getTxErrors()); nodeNetworkInfo.put("transmittedCarrier", netInterfaceStat.getTxCarrier()); nodeNetworkInfo.put("transmittedCollision", netInterfaceStat.getTxCollisions()); nodeNetworkInfo.put("transmittedOverruns", netInterfaceStat.getTxOverruns()); nodeNetworkInfo.put("transmittedPackets", netInterfaceStat.getTxPackets()); nodeNetworkInfo.put("speed", netInterfaceStat.getSpeed()); nodeNetworkInfoList.add(nodeNetworkInfo); } return nodeNetworkInfoList; } }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeNetworkInfos() { List<Map<Object, Object>> nodeNetworkInfoList = new ArrayList<Map<Object, Object>>(); Map<Object, Object> nodeNetworkInfo = null; String[] netInterfaceList = null; NetInterfaceStat netInterfaceStat = null; try { netInterfaceList = sigar.getNetInterfaceList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (String netInterface : netInterfaceList) { try { netInterfaceStat = sigar.getNetInterfaceStat(netInterface); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } nodeNetworkInfo = new HashMap<Object, Object>(); nodeNetworkInfo.put("interfaceName", netInterface); nodeNetworkInfo.put("receivedBytes", netInterfaceStat.getRxBytes()); nodeNetworkInfo.put("receivedDropped", netInterfaceStat.getRxDropped()); nodeNetworkInfo.put("receivedErrors", netInterfaceStat.getRxErrors()); nodeNetworkInfo.put("receivedFrame", netInterfaceStat.getRxFrame()); nodeNetworkInfo.put("receivedOverruns", netInterfaceStat.getRxOverruns()); nodeNetworkInfo.put("receivedPackets", netInterfaceStat.getRxPackets()); nodeNetworkInfo.put("transmittedBytes", netInterfaceStat.getTxBytes()); nodeNetworkInfo.put("transmittedDropped", netInterfaceStat.getTxDropped()); nodeNetworkInfo.put("transmittedErrors", netInterfaceStat.getTxErrors()); nodeNetworkInfo.put("transmittedCarrier", netInterfaceStat.getTxCarrier()); nodeNetworkInfo.put("transmittedCollision", netInterfaceStat.getTxCollisions()); nodeNetworkInfo.put("transmittedOverruns", netInterfaceStat.getTxOverruns()); nodeNetworkInfo.put("transmittedPackets", netInterfaceStat.getTxPackets()); nodeNetworkInfo.put("speed", netInterfaceStat.getSpeed()); nodeNetworkInfoList.add(nodeNetworkInfo); } return nodeNetworkInfoList; } SigarNodeInfoProvider(); }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeNetworkInfos() { List<Map<Object, Object>> nodeNetworkInfoList = new ArrayList<Map<Object, Object>>(); Map<Object, Object> nodeNetworkInfo = null; String[] netInterfaceList = null; NetInterfaceStat netInterfaceStat = null; try { netInterfaceList = sigar.getNetInterfaceList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (String netInterface : netInterfaceList) { try { netInterfaceStat = sigar.getNetInterfaceStat(netInterface); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } nodeNetworkInfo = new HashMap<Object, Object>(); nodeNetworkInfo.put("interfaceName", netInterface); nodeNetworkInfo.put("receivedBytes", netInterfaceStat.getRxBytes()); nodeNetworkInfo.put("receivedDropped", netInterfaceStat.getRxDropped()); nodeNetworkInfo.put("receivedErrors", netInterfaceStat.getRxErrors()); nodeNetworkInfo.put("receivedFrame", netInterfaceStat.getRxFrame()); nodeNetworkInfo.put("receivedOverruns", netInterfaceStat.getRxOverruns()); nodeNetworkInfo.put("receivedPackets", netInterfaceStat.getRxPackets()); nodeNetworkInfo.put("transmittedBytes", netInterfaceStat.getTxBytes()); nodeNetworkInfo.put("transmittedDropped", netInterfaceStat.getTxDropped()); nodeNetworkInfo.put("transmittedErrors", netInterfaceStat.getTxErrors()); nodeNetworkInfo.put("transmittedCarrier", netInterfaceStat.getTxCarrier()); nodeNetworkInfo.put("transmittedCollision", netInterfaceStat.getTxCollisions()); nodeNetworkInfo.put("transmittedOverruns", netInterfaceStat.getTxOverruns()); nodeNetworkInfo.put("transmittedPackets", netInterfaceStat.getTxPackets()); nodeNetworkInfo.put("speed", netInterfaceStat.getSpeed()); nodeNetworkInfoList.add(nodeNetworkInfo); } return nodeNetworkInfoList; } SigarNodeInfoProvider(); Map<Object, Object> getNodeMemoryInfo(); List<Map<Object, Object>> getNodeCpuInfos(); Map<Object, Object> getNodeSwapInfo(); List<Map<Object, Object>> getNodeNetworkInfos(); Map<Object, Object> getNodeOSInfo(); Map<Object, Object> getNodeUpTimeInfo(); List<Map<Object, Object>> getNodeDiskInfos(); List<Map<Object, Object>> getSortedListByItem(final String item); Map<String, Object> getNodeInfo(int topProcessCount); }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeNetworkInfos() { List<Map<Object, Object>> nodeNetworkInfoList = new ArrayList<Map<Object, Object>>(); Map<Object, Object> nodeNetworkInfo = null; String[] netInterfaceList = null; NetInterfaceStat netInterfaceStat = null; try { netInterfaceList = sigar.getNetInterfaceList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (String netInterface : netInterfaceList) { try { netInterfaceStat = sigar.getNetInterfaceStat(netInterface); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } nodeNetworkInfo = new HashMap<Object, Object>(); nodeNetworkInfo.put("interfaceName", netInterface); nodeNetworkInfo.put("receivedBytes", netInterfaceStat.getRxBytes()); nodeNetworkInfo.put("receivedDropped", netInterfaceStat.getRxDropped()); nodeNetworkInfo.put("receivedErrors", netInterfaceStat.getRxErrors()); nodeNetworkInfo.put("receivedFrame", netInterfaceStat.getRxFrame()); nodeNetworkInfo.put("receivedOverruns", netInterfaceStat.getRxOverruns()); nodeNetworkInfo.put("receivedPackets", netInterfaceStat.getRxPackets()); nodeNetworkInfo.put("transmittedBytes", netInterfaceStat.getTxBytes()); nodeNetworkInfo.put("transmittedDropped", netInterfaceStat.getTxDropped()); nodeNetworkInfo.put("transmittedErrors", netInterfaceStat.getTxErrors()); nodeNetworkInfo.put("transmittedCarrier", netInterfaceStat.getTxCarrier()); nodeNetworkInfo.put("transmittedCollision", netInterfaceStat.getTxCollisions()); nodeNetworkInfo.put("transmittedOverruns", netInterfaceStat.getTxOverruns()); nodeNetworkInfo.put("transmittedPackets", netInterfaceStat.getTxPackets()); nodeNetworkInfo.put("speed", netInterfaceStat.getSpeed()); nodeNetworkInfoList.add(nodeNetworkInfo); } return nodeNetworkInfoList; } SigarNodeInfoProvider(); Map<Object, Object> getNodeMemoryInfo(); List<Map<Object, Object>> getNodeCpuInfos(); Map<Object, Object> getNodeSwapInfo(); List<Map<Object, Object>> getNodeNetworkInfos(); Map<Object, Object> getNodeOSInfo(); Map<Object, Object> getNodeUpTimeInfo(); List<Map<Object, Object>> getNodeDiskInfos(); List<Map<Object, Object>> getSortedListByItem(final String item); Map<String, Object> getNodeInfo(int topProcessCount); static final char SLEEP; static final char RUN; static final char STOP; static final char ZOMBIE; static final char IDLE; static final int HUNDRED; static final int NUMBER_1024; }