Search in sources :

Example 1 with ApiCommissionState

use of com.cloudera.api.swagger.model.ApiCommissionState in project cloudbreak by hortonworks.

the class ClouderaManagerHostHealthyStatusChecker method filterForHealthy.

private Set<String> filterForHealthy(ApiHostList hostList) {
    // Recent heartbeat, GOOD_HEALTH
    Set<String> goodHealthSet = new HashSet<>();
    for (ApiHost apiHost : hostList.getItems()) {
        String hostname = apiHost.getHostname();
        Instant lastheatbeat = null;
        if (StringUtils.isNotBlank(apiHost.getLastHeartbeat())) {
            lastheatbeat = Instant.parse(apiHost.getLastHeartbeat());
        }
        ApiHealthSummary healthSummary = apiHost.getHealthSummary();
        boolean inMaintenance = apiHost.getMaintenanceMode();
        ApiCommissionState commissionState = apiHost.getCommissionState();
        LOGGER.trace("CM info for: [{}]: lastHeatbeat={}, lastHeartbeatInstant={}, healthSummary={}, commissionState={}, maint={}", hostname, apiHost.getLastHeartbeat(), lastheatbeat, healthSummary, commissionState, inMaintenance);
        if (lastheatbeat != null && start.isBefore(lastheatbeat) && healthSummary == ApiHealthSummary.GOOD) {
            goodHealthSet.add(hostname);
        }
    }
    LOGGER.info("Found good host count={}", goodHealthSet.size());
    return goodHealthSet;
}
Also used : ApiCommissionState(com.cloudera.api.swagger.model.ApiCommissionState) Instant(java.time.Instant) ApiHealthSummary(com.cloudera.api.swagger.model.ApiHealthSummary) HashSet(java.util.HashSet) ApiHost(com.cloudera.api.swagger.model.ApiHost)

Aggregations

ApiCommissionState (com.cloudera.api.swagger.model.ApiCommissionState)1 ApiHealthSummary (com.cloudera.api.swagger.model.ApiHealthSummary)1 ApiHost (com.cloudera.api.swagger.model.ApiHost)1 Instant (java.time.Instant)1 HashSet (java.util.HashSet)1