public void reconcileAlertDefinitions(Clusters clusters, boolean updateScriptPaths)  throws AmbariException {
    Map<String, Cluster> clusterMap = clusters.getClusters();
    if (null == clusterMap || clusterMap.size() == 0) {
      return;
    }

    // for every cluster
    for (Cluster cluster : clusterMap.values()) {
       reconcileAlertDefinitions(cluster, updateScriptPaths);
    }

  }
Compares the alert definitions defined on the stack with those in the
database and merges any new or updated definitions. This method will first
determine the services that are installed on each cluster to prevent alert
definitions from undeployed services from being shown.
<p/>
This method will also detect "agent" alert definitions, which are
definitions that should be run on agent hosts but are not associated with a
service.

@param clusters all clusters
@param updateScriptPaths whether existing script-based alerts should be updated
       with possibly new paths from the stack definition
ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java