当前位置: 首页>>代码示例>>Java>>正文


Java NetRoute类代码示例

本文整理汇总了Java中org.hyperic.sigar.NetRoute的典型用法代码示例。如果您正苦于以下问题:Java NetRoute类的具体用法?Java NetRoute怎么用?Java NetRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NetRoute类属于org.hyperic.sigar包,在下文中一共展示了NetRoute类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: output

import org.hyperic.sigar.NetRoute; //导入依赖的package包/类
public void output(String[] args) throws SigarException {
    NetRoute[] routes = this.sigar.getNetRouteList();

    printf(HEADER);

    for (int i=0; i<routes.length; i++) {
        NetRoute route = routes[i];

        ArrayList items = new ArrayList();
        items.add(route.getDestination());
        items.add(route.getGateway());
        items.add(route.getMask());
        items.add(flags(route.getFlags()));
        items.add(String.valueOf(route.getMetric()));
        items.add(String.valueOf(route.getRefcnt()));
        items.add(route.getIfname());

        printf(items);
    }
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:Route.java

示例2: initializePlugin

import org.hyperic.sigar.NetRoute; //导入依赖的package包/类
@Override
public void initializePlugin(StagemonitorPlugin.InitArguments initArguments) throws Exception {
	final CorePlugin corePlugin = initArguments.getPlugin(CorePlugin.class);

	corePlugin.getGrafanaClient().sendGrafanaDashboardAsync("grafana/ElasticsearchHostDashboard.json");
	if (sigar == null) {
		if (!SigarNativeBindingLoader.loadNativeSigarBindings()) {
			// redeploys are a problem, because the native libs can only be loaded by one class loader
			// this would lead to a UnsatisfiedLinkError: Native Library sigar already loaded in another class loader
			throw new RuntimeException("The OsPlugin only works with one application per JVM " +
					"and does not work after a redeploy");
		}
		sigar = newSigar();
	}
	initArguments.getMetricRegistry().registerAll(init(new CpuMetricSet(sigar, sigar.getCpuInfoList()[0])));
	initArguments.getMetricRegistry().registerAll(init(new MemoryMetricSet(sigar)));
	initArguments.getMetricRegistry().registerAll(init(new SwapMetricSet(sigar)));

	Set<String> routedNetworkInterfaces = new HashSet<String>();
	for (NetRoute netRoute : sigar.getNetRouteList()) {
		routedNetworkInterfaces.add(netRoute.getIfname());
	}
	for (String ifname : routedNetworkInterfaces) {
		initArguments.getMetricRegistry().registerAll(init(new NetworkMetricSet(ifname, sigar)));
	}
	@SuppressWarnings("unchecked")
	final Set<Map.Entry<String, FileSystem>> entries = (Set<Map.Entry<String, FileSystem>>) sigar.getFileSystemMap().entrySet();
	for (Map.Entry<String, FileSystem> e : entries) {
		final FileSystem fs = e.getValue();
		if (fs.getType() == FileSystem.TYPE_LOCAL_DISK || fs.getType() == FileSystem.TYPE_NETWORK) {
			initArguments.getMetricRegistry().registerAll(init(new FileSystemMetricSet(e.getKey(), sigar)));
		}
	}
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:35,代码来源:OsPlugin.java

示例3: getRoutes

import org.hyperic.sigar.NetRoute; //导入依赖的package包/类
public static NetRoute[] getRoutes() throws SigarException {
	_init();

	return sigar.getNetRouteList();
}
 
开发者ID:giiwa,项目名称:giiwa,代码行数:6,代码来源:Host.java


注:本文中的org.hyperic.sigar.NetRoute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。