private void clearStaleAlerts(String hostName, Long definitionId) throws AmbariException {
    if (StringUtil.isNotBlank(hostName)) {
      Host host = m_clusters.get().getHosts().stream().filter(h -> h.getHostName().equals(hostName))
          .findFirst().orElse(null);
      if (host != null) {
        alertHelper.clearStaleAlert(host.getHostId(), definitionId);
      }
    } else {
      alertHelper.clearStaleAlert(definitionId);
    }
  }
Adds an alert. Checks for a new state before creating a new history record.

@param event
         the event to handle.
ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java