use of org.ow2.proactive.resourcemanager.node.jmx.SigarExposer in project scheduling by ow2-proactive.
the class RMNodeStarter method registerInRM.
/**
* Tries to join to the Resource Manager with a specified timeout
* at the given URL, logs with provided credentials and adds the local node to
* the Resource Manager. Handles all errors/exceptions.
*/
protected ResourceManager registerInRM(final Credentials credentials, final String rmURL, String nodeName, Collection<Node> nodes) {
RMAuthentication rmAuth = joinResourceManager(rmURL);
ResourceManager rm = loginToResourceManager(credentials, rmAuth);
startMonitoring(rmAuth);
for (final Node node : nodes) {
nodeSetJmxUrl(sigarExposer, node);
addNodeToResourceManager(rmURL, node, rm);
}
return rm;
}
use of org.ow2.proactive.resourcemanager.node.jmx.SigarExposer in project scheduling by ow2-proactive.
the class RMNodeStarter method startMonitoring.
private void startMonitoring(RMAuthentication auth) {
if (!disabledMonitoring) {
if (sigarExposer != null) {
logger.info("Shutting down previous JMX monitoring.");
sigarExposer.shutdown();
}
// initializing JMX server with Sigar beans
sigarExposer = new SigarExposer(nodeName);
final RMAuthentication rmAuth = auth;
logger.info("Starting JMX monitoring.");
sigarExposer.boot(auth, false, new PermissionChecker() {
@Override
public boolean checkPermission(Credentials cred) {
ResourceManager rm = null;
try {
rm = rmAuth.login(cred);
if (NB_OF_ADD_NODE_ATTEMPTS == 0)
return true;
boolean isAdmin = rm.isNodeAdmin(nodes.values().iterator().next().getNodeInformation().getURL()).getBooleanValue();
if (!isAdmin) {
throw new SecurityException("Permission denied");
}
return true;
} catch (LoginException e) {
throw new SecurityException(e);
} finally {
if (rm != null) {
rm.disconnect();
}
}
}
});
} else {
logger.info("JMX monitoring is disabled.");
}
}
Aggregations