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;
}
Aggregations