regigster NetInterface beans
This commit is contained in:
parent
273a7aad96
commit
bd94719a4a
|
@ -33,6 +33,7 @@ import javax.management.ObjectInstance;
|
|||
import javax.management.ObjectName;
|
||||
|
||||
import org.hyperic.sigar.FileSystem;
|
||||
import org.hyperic.sigar.NetInterfaceConfig;
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
import org.hyperic.sigar.SigarLoader;
|
||||
|
@ -250,6 +251,28 @@ public class SigarRegistry extends AbstractMBean {
|
|||
throw unexpectedError("FileSystemList", e);
|
||||
}
|
||||
|
||||
//NetInterface beans
|
||||
try {
|
||||
String[] ifnames = sigarImpl.getNetInterfaceList();
|
||||
for (int i=0; i<ifnames.length; i++) {
|
||||
String name = ifnames[i];
|
||||
NetInterfaceConfig ifconfig =
|
||||
this.sigar.getNetInterfaceConfig(name);
|
||||
try {
|
||||
sigarImpl.getNetInterfaceStat(name);
|
||||
} catch (SigarException e) {
|
||||
continue;
|
||||
}
|
||||
ReflectedMBean mbean =
|
||||
new ReflectedMBean(sigarImpl, "NetInterface", name);
|
||||
mbean.setType(mbean.getType() + "Stat");
|
||||
mbean.putAttributes(ifconfig);
|
||||
registerMBean(mbean);
|
||||
}
|
||||
} catch (SigarException e) {
|
||||
throw unexpectedError("NetInterfaceList", e);
|
||||
}
|
||||
|
||||
//physical memory bean
|
||||
registerMBean(new ReflectedMBean(sigarImpl, "Mem"));
|
||||
//swap memory bean
|
||||
|
|
Loading…
Reference in New Issue