add aggregate Cpu mbeans

This commit is contained in:
Doug MacEachern 2008-10-09 06:22:46 +00:00
parent 7985dea967
commit 63478f28ff
1 changed files with 14 additions and 5 deletions

View File

@ -215,6 +215,7 @@ public class SigarRegistry extends AbstractMBean {
* @see AbstractMBean#postRegister(Boolean) * @see AbstractMBean#postRegister(Boolean)
*/ */
public void postRegister(Boolean success) { public void postRegister(Boolean success) {
ReflectedMBean mbean;
super.postRegister(success); super.postRegister(success);
@ -231,8 +232,8 @@ public class SigarRegistry extends AbstractMBean {
for (int i=0; i<info.length; i++) { for (int i=0; i<info.length; i++) {
String idx = String.valueOf(i); String idx = String.valueOf(i);
ReflectedMBean mbean = mbean =
new ReflectedMBean(sigarImpl, "CpuCoreTime", idx); new ReflectedMBean(sigarImpl, "CpuCore", idx);
mbean.setType("CpuList"); mbean.setType("CpuList");
registerMBean(mbean); registerMBean(mbean);
mbean = mbean =
@ -241,6 +242,14 @@ public class SigarRegistry extends AbstractMBean {
registerMBean(mbean); registerMBean(mbean);
} }
mbean = new ReflectedMBean(sigarImpl, "Cpu");
mbean.putAttributes(info[0]);
registerMBean(mbean);
mbean = new ReflectedMBean(sigarImpl, "CpuUsage");
mbean.setType("CpuPerc");
registerMBean(mbean);
//FileSystem beans //FileSystem beans
try { try {
FileSystem[] fslist = sigarImpl.getFileSystemList(); FileSystem[] fslist = sigarImpl.getFileSystemList();
@ -250,7 +259,7 @@ public class SigarRegistry extends AbstractMBean {
continue; continue;
} }
String name = fs.getDirName(); String name = fs.getDirName();
ReflectedMBean mbean = mbean =
new ReflectedMBean(sigarImpl, "FileSystem", name); new ReflectedMBean(sigarImpl, "FileSystem", name);
mbean.setType(mbean.getType() + "Usage"); mbean.setType(mbean.getType() + "Usage");
mbean.putAttributes(fs); mbean.putAttributes(fs);
@ -272,7 +281,7 @@ public class SigarRegistry extends AbstractMBean {
} catch (SigarException e) { } catch (SigarException e) {
continue; continue;
} }
ReflectedMBean mbean = mbean =
new ReflectedMBean(sigarImpl, "NetInterface", name); new ReflectedMBean(sigarImpl, "NetInterface", name);
mbean.setType(mbean.getType() + "Stat"); mbean.setType(mbean.getType() + "Stat");
mbean.putAttributes(ifconfig); mbean.putAttributes(ifconfig);
@ -283,7 +292,7 @@ public class SigarRegistry extends AbstractMBean {
} }
//network info bean //network info bean
ReflectedMBean mbean = new ReflectedMBean(sigarImpl, "NetInfo"); mbean = new ReflectedMBean(sigarImpl, "NetInfo");
try { try {
mbean.putAttribute("FQDN", sigarImpl.getFQDN()); mbean.putAttribute("FQDN", sigarImpl.getFQDN());
} catch (SigarException e) { } catch (SigarException e) {