use of com.sequenceiq.node.health.client.CdpNodeStatusMonitorClient in project cloudbreak by hortonworks.
the class NodeStatusService method saltPing.
public RPCResponse<NodeStatusProto.SaltHealthReport> saltPing(Long stackId) {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
MDCBuilder.buildMdcContext(stack);
LOGGER.debug("Retrieving salt ping report from the hosts of stack: {}", stack.getResourceCrn());
try (CdpNodeStatusMonitorClient client = factory.getClient(stack, stack.getPrimaryGatewayInstance())) {
return client.saltPing(false, false);
} catch (CdpNodeStatusMonitorClientException e) {
throw new CloudbreakServiceException("Could not get salt ping report from stack.");
}
}
use of com.sequenceiq.node.health.client.CdpNodeStatusMonitorClient in project cloudbreak by hortonworks.
the class NodeStatusService method getSystemMetrics.
public RPCResponse<NodeStatusProto.NodeStatusReport> getSystemMetrics(Stack stack) {
MDCBuilder.buildMdcContext(stack);
LOGGER.debug("Retrieving system metrics report from the hosts of stack: {}", stack.getResourceCrn());
try (CdpNodeStatusMonitorClient client = factory.getClient(stack, stack.getPrimaryGatewayInstance())) {
return client.systemMetricsReport();
} catch (CdpNodeStatusMonitorClientException e) {
throw new CloudbreakServiceException("Could not get system metrics report from stack.");
}
}
use of com.sequenceiq.node.health.client.CdpNodeStatusMonitorClient in project cloudbreak by hortonworks.
the class NodeStatusService method getMeteringReport.
public RPCResponse<NodeStatusProto.NodeStatusReport> getMeteringReport(Stack stack) {
MDCBuilder.buildMdcContext(stack);
LOGGER.debug("Retrieving metering report from the hosts of stack: {}", stack.getResourceCrn());
try (CdpNodeStatusMonitorClient client = factory.getClient(stack, stack.getPrimaryGatewayInstance())) {
return client.nodeMeteringReport();
} catch (CdpNodeStatusMonitorClientException e) {
throw new CloudbreakServiceException("Could not get metering report from stack.");
}
}
use of com.sequenceiq.node.health.client.CdpNodeStatusMonitorClient in project cloudbreak by hortonworks.
the class CdpNodeStatusMonitorClientFactory method getClient.
public CdpNodeStatusMonitorClient getClient(Stack stack, InstanceMetaData instance) {
final Optional<String> username;
final Optional<String> password;
if (stack.getCluster() != null && StringUtils.isNoneEmpty(stack.getCluster().getCdpNodeStatusMonitorUser(), stack.getCluster().getCdpNodeStatusMonitorPassword())) {
username = Optional.of(stack.getCluster().getCdpNodeStatusMonitorUser());
password = Optional.of(stack.getCluster().getCdpNodeStatusMonitorPassword());
} else {
username = Optional.empty();
password = Optional.empty();
}
CdpNodeStatusMonitorClient client;
if (clusterProxyService.isCreateConfigForClusterProxy(stack)) {
client = buildClientForClusterProxy(stack, instance, username, password);
} else {
client = buildClientForDirectConnect(stack, instance, username, password);
}
return client;
}
use of com.sequenceiq.node.health.client.CdpNodeStatusMonitorClient in project cloudbreak by hortonworks.
the class CdpNodeStatusMonitorClientFactory method buildNodeStatusMonitorClient.
private CdpNodeStatusMonitorClient buildNodeStatusMonitorClient(HttpClientConfig clientConfig, int port, String basePath, Map<String, String> headers, Optional<String> username, Optional<String> password) {
Client restClient;
try {
restClient = RestClientUtil.createClient(clientConfig.getServerCert(), clientConfig.getClientCert(), clientConfig.getClientKey(), connectionTimeoutMillis, readTimeoutMillis, restDebug);
} catch (Exception e) {
throw new CloudbreakServiceException("Unable to create client for node status checks", e);
}
URL url = null;
try {
url = getUrl(clientConfig, port, basePath);
} catch (MalformedURLException e) {
throw new CloudbreakServiceException("Unable to build url to check node status", e);
}
if (username.isPresent() && password.isPresent()) {
return instantiateClient(headers, restClient, url, username, password);
}
return instantiateClient(headers, restClient, url);
}
Aggregations