class HealthCheck extends AbstractCheckDescriptor {

  @Override
  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
      throws AmbariException {

    AlertsDAO alertsDAO = alertsDAOProvider.get();
    final String clusterName = request.getClusterName();
    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
    List<AlertCurrentEntity> alerts = alertsDAO.findCurrentByCluster(cluster.getClusterId());

    List<String> errorMessages = new ArrayList<>();

    for (AlertCurrentEntity alert : alerts) {
      AlertHistoryEntity alertHistory = alert.getAlertHistory();
      AlertState alertState = alertHistory.getAlertState();
      if (ALERT_STATES.contains(alertState) && !alert.getMaintenanceState().equals(MaintenanceState.ON)) {
        String state = alertState.name();
        String label = alertHistory.getAlertDefinition().getLabel();
        String hostName = alertHistory.getHostName();

        if (hostName == null) {
          errorMessages.add(state + ": " + label);
        } else {
          errorMessages.add(state + ": " + label + ": " + hostName);
        }
        prerequisiteCheck.getFailedDetail().add(new AlertDetail(state, label, hostName));
      }
    }

    if (!errorMessages.isEmpty()) {
      prerequisiteCheck.getFailedOn().add(clusterName);
      prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING);
      String failReason = getFailReason(prerequisiteCheck, request);
      prerequisiteCheck.setFailReason(
          String.format(failReason, StringUtils.join(errorMessages, System.lineSeparator())));
    }
  }

  public  HealthCheck();

}