netIf = sigar.getNetInterfaceList(); for (int i = 0; i < netIf.length; i++) { NetInterfaceStat net = new NetInterfaceStat();
ifaces = sigar.getNetInterfaceList();
public void output(String[] args) throws SigarException { //sigar/os info Version.printInfo(this.out); println(""); //uptime new Uptime(this.shell).output(args); println(""); //cpu info CpuInfo cpuinfo = new CpuInfo(this.shell); cpuinfo.displayTimes = false; cpuinfo.output(args); println(""); //memory info new Free(this.shell).output(args); println(""); println("File Systems........." + Arrays.asList(this.sigar.getFileSystemList())); println(""); println("Network Interfaces..." + Arrays.asList(this.sigar.getNetInterfaceList())); println(""); //system resource limits println("System resource limits:"); new Ulimit(this.shell).output(args); }
final String[] netInterfaceList = firstNonNull(sigar.getNetInterfaceList(), new String[0]); for (String interfaceName : netInterfaceList) { final NetInterfaceStat netInterfaceStat = sigar.getNetInterfaceStat(interfaceName);
private void initSigar() { if (sigar == null) { sigar = new Sigar(); try { netInterfaces = sigar.getNetInterfaceList(); prev = new SystemInfo(); prev.setBandWidth(getNetworkUsage()); } catch (SigarException e) { LOGGER.error("Network usage data retrieval failed.", e); } } }
for (String ni : sigar.getNetInterfaceList()) {
public String[] getNetInterfaceList() throws SigarException {return _sigar.getNetInterfaceList();}
/** * Register metrics tracked here * * @param metrics MetricsRegistry * @param owningClass class that should own metrics * @throws SigarException */ public static void registerMetrics(MetricsRegistry metrics, Class<?> owningClass) throws SigarException { final Sigar sigar = new Sigar(); String[] interfaceNames = sigar.getNetInterfaceList(); for (String interfaceName : interfaceNames) { registerMetrics(metrics, owningClass, interfaceName, sigar); } }
public Collection<String> getNetInterfacesNames() { try { HashSet<String> result = new HashSet<String>(); String[] names = sigar.getNetInterfaceList(); if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "The following network interface cards were detected by Sigar: " + Arrays.toString(names)); for (String name : names) { NetInterfaceConfig config = sigar.getNetInterfaceConfig(name); if (config.getAddress().equals(NetFlags.ANY_ADDR)) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "Skipping " + nameWithAddress(name, config) + " - invalid address"); } else { boolean added = result.add(name); if (added) { if (logger.isLoggable(Level.FINE)) logger.log(Level.FINE, nameWithAddress(name, config) + " will be registered for metrics"); } else { if (logger.isLoggable(Level.WARNING)) logger.log(Level.WARNING, "Skipping " + nameWithAddress(name, config) + " - a NIC by the same name has already been registered for metrics"); } } } return result; } catch (SigarException e) { throw new RuntimeException("Failed to get network interfaces names", e); } }
+ new BigDecimal(totalMemory).setScale(2, BigDecimal.ROUND_DOWN).floatValue() + " GB"); String[] nicList = sigar.getNetInterfaceList(); sb.append("\nNIC info: "); for (int i = 0; i < nicList.length; i++) {
+ new BigDecimal( totalMemory ).setScale( 2, BigDecimal.ROUND_DOWN ).floatValue() + " GB" ); String[] nicList = sigar.getNetInterfaceList(); sb.append( "\nNIC info: " ); for( int i = 0; i < nicList.length; i++ ) {
Map<String, Long> incomingNetworkTrafficMap = new HashMap<>(); Map<String, Long> outgoingNetworkTrafficMap = new HashMap<>(); String ifNames[] = sigar.getNetInterfaceList(); for (String name : ifNames) { NetInterfaceConfig ifconfig = sigar.getNetInterfaceConfig(name);
ifaces = sigar.getNetInterfaceList();
ifaces = sigar.getNetInterfaceList();
ifaces = sigar.getNetInterfaceList();
ifaces = sigar.getNetInterfaceList();
@Override public TcpData getTcpData() { TcpData data = new TcpData(); try { NetStat stat = sigar.getNetStat(); data.setTcpBound(stat.getTcpBound()); data.setTcpEstablished(stat.getTcpEstablished()); data.setTcpIdle(stat.getTcpIdle()); data.setTcpListen(stat.getTcpListen()); data.setTcpSynchronizedReceived(stat.getTcpSynRecv()); long inboundBytes = 0; long outboundBytes = 0; for(String netInterface : sigar.getNetInterfaceList()) { for(String mask : interfaceNames) { if(netInterface.matches(mask)) { inboundBytes += sigar.getNetInterfaceStat(netInterface).getRxBytes(); outboundBytes += sigar.getNetInterfaceStat(netInterface).getTxBytes(); } } } data.setTcpInboundTotal(inboundBytes); data.setTcpOutboundTotal(outboundBytes); logger.debug("getTcpData: {}", data); } catch (SigarException e) { logger.warn("Exception during getTcpData", e); } return data; }
org.hyperic.sigar.CpuInfo[] infos = sigar.getCpuInfoList(); String[] netInterfaceList = sigar.getNetInterfaceList(); OSNetInterfaceDetails[] netInterfaceConfigArray = new OSNetInterfaceDetails[netInterfaceList.length];
final String[] netInterfaceList = firstNonNull(sigar.getNetInterfaceList(), new String[0]); for (String interfaceName : netInterfaceList) { final NetInterfaceStat netInterfaceStat = sigar.getNetInterfaceStat(interfaceName);
final String[] netInterfaceList = firstNonNull(sigar.getNetInterfaceList(), new String[0]); for (String interfaceName : netInterfaceList) { final NetInterfaceStat netInterfaceStat = sigar.getNetInterfaceStat(interfaceName);