public Map<Long, List<Long>> prepareHostDefinitions(Long clusterId) {
    Map<Long, List<Long>> alertDefinitionsToHosts = new HashMap<>();

    alertDefinitionsHolder.getData().entrySet().stream()
        .filter(e -> e.getValue().getClusters() != null)
        .filter(e -> e.getValue().getClusters().get(clusterId) != null)
        .forEach(e -> e.getValue().getClusters().get(clusterId).getAlertDefinitions().stream()
            .forEach(l -> {
              alertDefinitionsToHosts.putIfAbsent(l.getDefinitionId(), new ArrayList<>());
              alertDefinitionsToHosts.get(l.getDefinitionId()).add(e.getKey());
            }));
    return alertDefinitionsToHosts;
  }
Retrieves alert definitions sent to agents.
@param clusterId cluster id
@return map definition id - host ids list
ambari-server/src/main/java/org/apache/ambari/server/alerts/StaleAlertRunnable.java