public List<StatusCommand> generateStatusCommands(String hostname) throws AmbariException {
    List<StatusCommand> cmds = new ArrayList<>();

    for (Cluster cl : clusters.getClustersForHost(hostname)) {
      Map<String, DesiredConfig> desiredConfigs = cl.getDesiredConfigs();
      for (ServiceComponentHost sch : cl.getServiceComponentHosts(hostname)) {
        switch (sch.getState()) {
          case INIT:
          case INSTALLING:
          case STARTING:
          case STOPPING:
            //don't send commands until component is installed at least
            continue;
          default:
            StatusCommand statusCmd = createStatusCommand(hostname, cl, sch, desiredConfigs);
            cmds.add(statusCmd);
        }

      }
    }
    return cmds;
  }
@param hostname
@return list of commands to get status of service components on a concrete host
ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java