register FileSystem beans
This commit is contained in:
parent
e2616dbac1
commit
273a7aad96
|
@ -32,6 +32,7 @@ import javax.management.MBeanServer;
|
||||||
import javax.management.ObjectInstance;
|
import javax.management.ObjectInstance;
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
|
import org.hyperic.sigar.FileSystem;
|
||||||
import org.hyperic.sigar.Sigar;
|
import org.hyperic.sigar.Sigar;
|
||||||
import org.hyperic.sigar.SigarException;
|
import org.hyperic.sigar.SigarException;
|
||||||
import org.hyperic.sigar.SigarLoader;
|
import org.hyperic.sigar.SigarLoader;
|
||||||
|
@ -197,7 +198,7 @@ public class SigarRegistry extends AbstractMBean {
|
||||||
this.mbeanServer.registerMBean(mbean, name);
|
this.mbeanServer.registerMBean(mbean, name);
|
||||||
this.managedBeans.add(instance.getObjectName());
|
this.managedBeans.add(instance.getObjectName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +231,25 @@ public class SigarRegistry extends AbstractMBean {
|
||||||
throw unexpectedError("CpuInfoList", e);
|
throw unexpectedError("CpuInfoList", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FileSystem beans
|
||||||
|
try {
|
||||||
|
FileSystem[] fslist = sigarImpl.getFileSystemList();
|
||||||
|
for (int i=0; i<fslist.length; i++) {
|
||||||
|
FileSystem fs = fslist[i];
|
||||||
|
if (fs.getType() != FileSystem.TYPE_LOCAL_DISK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String name = fs.getDirName();
|
||||||
|
ReflectedMBean mbean =
|
||||||
|
new ReflectedMBean(sigarImpl, "FileSystem", name);
|
||||||
|
mbean.setType(mbean.getType() + "Usage");
|
||||||
|
mbean.putAttributes(fs);
|
||||||
|
registerMBean(mbean);
|
||||||
|
}
|
||||||
|
} catch (SigarException e) {
|
||||||
|
throw unexpectedError("FileSystemList", e);
|
||||||
|
}
|
||||||
|
|
||||||
//physical memory bean
|
//physical memory bean
|
||||||
registerMBean(new ReflectedMBean(sigarImpl, "Mem"));
|
registerMBean(new ReflectedMBean(sigarImpl, "Mem"));
|
||||||
//swap memory bean
|
//swap memory bean
|
||||||
|
|
Loading…
Reference in New Issue