@RequiresSession
  public Map<String, AlertSummaryDTO> findCurrentPerHostCounts(long clusterId) {
    String sql = String.format(ALERT_COUNT_PER_HOST_SQL_TEMPLATE, HostAlertSummaryDTO.class.getName());

    StringBuilder sb = new StringBuilder(sql);

    TypedQuery<HostAlertSummaryDTO> query = m_entityManagerProvider.get().createQuery(sb.toString(), HostAlertSummaryDTO.class);

    query.setParameter("clusterId", Long.valueOf(clusterId));
    query.setParameter("okState", AlertState.OK);
    query.setParameter("warningState", AlertState.WARNING);
    query.setParameter("criticalState", AlertState.CRITICAL);
    query.setParameter("unknownState", AlertState.UNKNOWN);
    query.setParameter("maintenanceStateOff", MaintenanceState.OFF);

    Map<String, AlertSummaryDTO> map = new HashMap<>();
    List<HostAlertSummaryDTO> resultList = m_daoUtils.selectList(query);
    for (HostAlertSummaryDTO result : resultList) {
      map.put(result.getHostName(), result);
    }
    return map;
  }
Retrieves the summary information for all the hosts in the provided cluster.
The result is mapping from hostname to summary DTO.

@param clusterId
         the cluster id
@return map from hostnames to summary DTO
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java