use of org.apache.geode.management.MemberMXBean in project geode by apache.
the class DistributedSystemBridge method showDiskMetrics.
public DiskMetrics showDiskMetrics(String member) throws Exception {
MemberMXBean bean = validateMember(member);
DiskMetrics dm = new DiskMetrics();
dm.setDiskReadsRate(bean.getDiskReadsRate());
dm.setDiskWritesRate(bean.getDiskWritesRate());
dm.setTotalBackupInProgress(bean.getTotalBackupInProgress());
dm.setTotalBackupCompleted(bean.getTotalBackupCompleted());
dm.setDiskFlushAvgLatency(bean.getDiskFlushAvgLatency());
dm.setTotalBytesOnDisk(bean.getTotalDiskUsage());
return dm;
}
use of org.apache.geode.management.MemberMXBean in project geode by apache.
the class DistributedSystemBridge method getGroups.
/**
* @return list of groups visible to the Manager node
*/
public String[] getGroups() {
String[] groups = new String[0];
Collection<MemberMXBean> values = mapOfMembers.values();
if (values != null) {
Set<String> groupSet = new TreeSet<>();
for (MemberMXBean memberMXBean : values) {
String[] memberGroups = memberMXBean.getGroups();
if (memberGroups != null && memberGroups.length != 0) {
groupSet.addAll(Arrays.asList(memberGroups));
}
}
if (!groupSet.isEmpty()) {
groups = new String[groupSet.size()];
groups = groupSet.toArray(groups);
}
}
return groups;
}
use of org.apache.geode.management.MemberMXBean in project geode by apache.
the class DistributedSystemBridge method getMemberDiskstoreMap.
/**
* @return Lists all the members disk stores
*/
public Map<String, String[]> getMemberDiskstoreMap() {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
Map<String, String[]> mapOfDisks = new HashMap<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
mapOfDisks.put(bean.getMember(), bean.getDiskStores());
}
return mapOfDisks;
}
return Collections.emptyMap();
}
use of org.apache.geode.management.MemberMXBean in project geode by apache.
the class DistributedSystemBridge method validateMember.
private MemberMXBean validateMember(String member) throws Exception {
ObjectName objectName = MBeanJMXAdapter.getMemberMBeanName(member);
MemberMXBean bean = mapOfMembers.get(objectName);
if (bean != null) {
return bean;
} else {
throw new Exception(ManagementStrings.INVALID_MEMBER_NAME_OR_ID.toLocalizedString(member));
}
}
use of org.apache.geode.management.MemberMXBean in project geode by apache.
the class ManagementAdapter method handleManagerStart.
/**
* Handles all the distributed mbean creation part when a Manager is started
*/
public void handleManagerStart() throws ManagementException {
if (!isServiceInitialised("handleManagerStart")) {
return;
}
MBeanJMXAdapter jmxAdapter = service.getJMXAdapter();
Map<ObjectName, Object> registeredMBeans = jmxAdapter.getLocalGemFireMBean();
DistributedSystemBridge dsBridge = new DistributedSystemBridge(service);
this.aggregator = new MBeanAggregator(dsBridge);
// register the aggregator for Federation framework to use
service.addProxyListener(aggregator);
/*
* get the local member mbean as it need to be provided to aggregator first
*/
MemberMXBean localMember = service.getMemberMXBean();
ObjectName memberObjectName = MBeanJMXAdapter.getMemberMBeanName(InternalDistributedSystem.getConnectedInstance().getDistributedMember());
FederationComponent addedComp = service.getLocalManager().getFedComponents().get(memberObjectName);
service.afterCreateProxy(memberObjectName, MemberMXBean.class, localMember, addedComp);
for (ObjectName objectName : registeredMBeans.keySet()) {
if (objectName.equals(memberObjectName)) {
continue;
}
Object object = registeredMBeans.get(objectName);
ObjectInstance instance;
try {
instance = mbeanServer.getObjectInstance(objectName);
String className = instance.getClassName();
Class cls = ClassLoadUtil.classFromName(className);
Type[] intfTyps = cls.getGenericInterfaces();
FederationComponent newObj = service.getLocalManager().getFedComponents().get(objectName);
for (Type intfTyp1 : intfTyps) {
Class intfTyp = (Class) intfTyp1;
service.afterCreateProxy(objectName, intfTyp, object, newObj);
}
} catch (InstanceNotFoundException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed in Registering distributed mbean ");
}
throw new ManagementException(e);
} catch (ClassNotFoundException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed in Registering distributed mbean");
}
throw new ManagementException(e);
}
}
}
Aggregations