public Collection getCompletions() { String[] ifNames; try { ifNames = this.proxy.getNetInterfaceList(); } catch (SigarException e) { return super.getCompletions(); } return Arrays.asList(ifNames); }
private void netUsage(int checkIntervalSec) { try { if (netIf == null) { netIf = sigar.getNetInterfaceList();
public void output(String[] args) throws SigarException { String[] ifNames; if (args.length == 1) { ifNames = args; } else { ifNames = this.proxy.getNetInterfaceList(); } for (int i=0; i<ifNames.length; i++) { try { output(ifNames[i]); } catch (SigarException e) { println(ifNames[i] + "\t" + e.getMessage()); } } }
public void populate(SigarProxy sigar) throws SigarException { _interfaces = new ArrayList(); String[] names = sigar.getNetInterfaceList(); for (int i=0; i<names.length; i++) { _interfaces.add(NetInterfaceData.gather(sigar, names[i])); } }
try { SigarProxy s = SigarFactory.newSigar(); String[] netIfs = s.getNetInterfaceList(); netIfs = new HashSet<String>(Arrays.asList(netIfs)).toArray(new String[0]);
public List<NetworkAdapterInfo> getAllNetworkAdapters() throws SystemInfoException { List<NetworkAdapterInfo> adapters = new ArrayList<NetworkAdapterInfo>(); try { String[] interfaceNames = sigar.getNetInterfaceList(); if (interfaceNames != null) { for (String interfaceName : interfaceNames) { if (interfaceName.indexOf(':') != -1) { continue; //filter out virtual IPs } adapters.add(new NetworkAdapterInfo(sigar.getNetInterfaceConfig(interfaceName))); } } } catch (Exception e) { throw new SystemInfoException(e); } return adapters; }
public NetworkIOMetric(SigarProxy aSigar, MetricParams params) { super(aSigar); if (params.type.length() == 0) { type = RX_BYTES; } else { type = Arrays.asList(types).indexOf(params.type); if (type < 0) { throw new IllegalArgumentException("Unknown net io type: " + params.type); } } log.debug("Net metric type: " + type); LinkedList list = new LinkedList(); if (params.iface.length() != 0) { list.add(params.iface); } else { try { list.addAll(Arrays.asList(aSigar.getNetInterfaceList())); } catch (SigarException ex) { log.warn("Can't get network interfaces list", ex); } } interfaces = (String[]) list.toArray(new String[0]); dividingFactor = getUnitDividingFactor(params.getUnit()); }
public NetworkIOMetric(SigarProxy aSigar, MetricParams params) { super(aSigar); if (params.type.length() == 0) { type = RX_BYTES; } else { type = Arrays.asList(types).indexOf(params.type); if (type < 0) { throw new IllegalArgumentException("Unknown net io type: " + params.type); } } log.debug("Net metric type: " + type); LinkedList list = new LinkedList(); if (params.iface.length() != 0) { list.add(params.iface); } else { try { list.addAll(Arrays.asList(aSigar.getNetInterfaceList())); } catch (SigarException ex) { log.warn("Can't get network interfaces list", ex); } } interfaces = (String[]) list.toArray(new String[0]); dividingFactor = getUnitDividingFactor(params.getUnit()); }
public List<NetworkAdapterInfo> getAllNetworkAdapters() throws SystemInfoException { List<NetworkAdapterInfo> adapters = new ArrayList<NetworkAdapterInfo>(); try { String[] interfaceNames = sigar.getNetInterfaceList(); if (interfaceNames != null) { NetworkAdapterInfo.DisplayName displayName = NetworkAdapterInfo.DisplayName.FROM_NAME; // If Sigar can't get the adapter name it just starts naming the network adapters as eth0, eth1, etc. // This can be confusing on Windows, so we switch to their description // All references should be the same, as we are are only changing the displayName if (this.getOperatingSystemType() == OperatingSystemType.WINDOWS) { displayName = NetworkAdapterInfo.DisplayName.FROM_DESCRIPTION; } for (String interfaceName : interfaceNames) { if (interfaceName.indexOf(':') != -1) { continue; //filter out virtual IPs } adapters.add(new NetworkAdapterInfo(sigar.getNetInterfaceConfig(interfaceName), displayName)); } } } catch (Exception e) { throw new SystemInfoException(e); } return adapters; }
static void logAvailableInterfaces(SigarProxy sigar) { log.info("*** Logging available network interfaces ***"); try { String[] list = sigar.getNetInterfaceList(); for (int n = 0; n < list.length; n++) { NetInterfaceConfig ifc = sigar.getNetInterfaceConfig(list[n]); log.info("Network interface: iface=" + ifc.getName() + " addr=" + ifc.getAddress() + " type=" + ifc.getType()); } } catch (SigarException e) { log.debug("Can't get network info", e); } }
static void logAvailableInterfaces(SigarProxy sigar) { log.info("*** Logging available network interfaces ***"); try { String[] list = sigar.getNetInterfaceList(); for (int n = 0; n < list.length; n++) { NetInterfaceConfig ifc = sigar.getNetInterfaceConfig(list[n]); log.info("Network interface: iface=" + ifc.getName() + " addr=" + ifc.getAddress() + " type=" + ifc.getType()); } } catch (SigarException e) { log.debug("Can't get network info", e); } }
for (final String interfaceName : this.sigar.getNetInterfaceList()) {
for (final String interfaceName : this.sigar.getNetInterfaceList()) {
for (final String netInterface : instance.getNetInterfaceList()) {
for (final String netInterface : sigar.getNetInterfaceList()) { systemSnapshot.getNetworks().put(netInterface, fromCopy(new NetworkSnapshot(), sigar.getNetInterfaceStat(netInterface)));