Search in sources :

Example 1 with CdpNodeStatuses

use of com.sequenceiq.node.health.client.model.CdpNodeStatuses in project cloudbreak by hortonworks.

the class NodeStatusCheckerJob method executeNodeStatusCheck.

private void executeNodeStatusCheck(Stack stack) {
    boolean nodeStatusCheckEnabled = true;
    CdpNodeStatusRequest.Builder requestBuilder = CdpNodeStatusRequest.Builder.builder();
    String accountId = Crn.safeFromString(stack.getResourceCrn()).getAccountId();
    if (StackType.WORKLOAD.equals(stack.getType())) {
        nodeStatusCheckEnabled = entitlementService.datahubNodestatusCheckEnabled(accountId);
    }
    if (nodeStatusCheckEnabled) {
        if (StackType.WORKLOAD.equals(stack.getType())) {
            requestBuilder.withMetering(true);
        }
        CdpNodeStatusRequest request = requestBuilder.withCmMonitoring(true).withSkipObjectMapping(true).build();
        CdpNodeStatuses statuses = nodeStatusService.getNodeStatuses(stack, request);
        processNodeStatusReport(statuses.getNetworkReport(), NodeStatusProto.NodeStatus::getNetworkDetails, stack, "Network");
        processNodeStatusReport(statuses.getServicesReport(), NodeStatusProto.NodeStatus::getServicesDetails, stack, "Services");
        processNodeStatusReport(statuses.getSystemMetricsReport(), NodeStatusProto.NodeStatus::getSystemMetrics, stack, "System metrics");
        processCmMetricsReport(statuses.getCmMetricsReport(), stack);
    }
}
Also used : CdpNodeStatuses(com.sequenceiq.node.health.client.model.CdpNodeStatuses) CdpNodeStatusRequest(com.sequenceiq.node.health.client.model.CdpNodeStatusRequest)

Example 2 with CdpNodeStatuses

use of com.sequenceiq.node.health.client.model.CdpNodeStatuses in project cloudbreak by hortonworks.

the class NodeStatusJob method checkNodeHealthReports.

private void checkNodeHealthReports(Stack stack, Set<InstanceMetaData> checkableInstances) {
    for (InstanceMetaData instanceMetaData : checkableInstances) {
        try {
            CdpNodeStatuses nodeStatuses = checkedMeasure(() -> freeIpaNodeStatusService.nodeStatusReport(stack, instanceMetaData), LOGGER, "FreeIPA node status job checks ran in {}ms");
            LOGGER.debug("Fetching node health reports for instance: {}", instanceMetaData.getInstanceId());
            if (nodeStatuses.getNetworkReport().isPresent()) {
                logReportResult(instanceMetaData, nodeStatuses.getNetworkReport().get(), "network");
            }
            if (nodeStatuses.getServicesReport().isPresent()) {
                logReportResult(instanceMetaData, nodeStatuses.getServicesReport().get(), "services");
            }
            if (nodeStatuses.getSystemMetricsReport().isPresent()) {
                logReportResult(instanceMetaData, nodeStatuses.getServicesReport().get(), "system metrics");
            }
        } catch (Exception e) {
            LOGGER.info("FreeIpaClientException occurred during node status check: " + e.getMessage(), e);
        }
    }
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) CdpNodeStatuses(com.sequenceiq.node.health.client.model.CdpNodeStatuses) InterruptSyncingException(com.sequenceiq.freeipa.sync.InterruptSyncingException) JobExecutionException(org.quartz.JobExecutionException)

Aggregations

CdpNodeStatuses (com.sequenceiq.node.health.client.model.CdpNodeStatuses)2 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)1 InterruptSyncingException (com.sequenceiq.freeipa.sync.InterruptSyncingException)1 CdpNodeStatusRequest (com.sequenceiq.node.health.client.model.CdpNodeStatusRequest)1 JobExecutionException (org.quartz.JobExecutionException)1