StackId stackId;
Cluster cluster = clusterFsm.getCluster(clusterName);
stackId = cluster.getDesiredStackVersion();
MaintenanceStateHelper psh = injector.getInstance(MaintenanceStateHelper.class);
List<ServiceComponentHost> scHosts = cluster.getServiceComponentHosts(heartbeat.getHostname());
for (ServiceComponentHost scHost : scHosts) {
ComponentInfo componentInfo =
ambariMetaInfo.getComponent(stackId.getStackName(),
stackId.getStackVersion(), scHost.getServiceName(),
scHost.getServiceComponentName());
String status = scHost.getState().name();
String category = componentInfo.getCategory();
if (MaintenanceState.OFF == psh.getEffectiveState(scHost, host)) {
if (category.equals("MASTER")) {
++masterCount;
if (status.equals("STARTED")) {
++mastersRunning;
}