ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject git commit: AMBARI-7191. Alerts: rename old alerts endpoint for new alerts and provide summary info (ncole)
Date Mon, 08 Sep 2014 14:04:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-alerts-dev 0b406cbef -> 1f1059cff


AMBARI-7191. Alerts: rename old alerts endpoint for new alerts and provide summary info (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1f1059cf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f1059cf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f1059cf

Branch: refs/heads/branch-alerts-dev
Commit: 1f1059cff1ac749e5bdc8fd98febccb7ca346652
Parents: 0b406cb
Author: Nate Cole <ncole@hortonworks.com>
Authored: Sun Sep 7 16:42:35 2014 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Mon Sep 8 10:04:00 2014 -0400

----------------------------------------------------------------------
 .../api/resources/AlertResourceDefinition.java  |   4 +-
 .../server/api/services/AlertService.java       |   4 +-
 .../server/api/services/ClusterService.java     |   2 +-
 .../ambari/server/api/services/HostService.java |   2 +-
 .../server/api/services/ServiceService.java     |   2 +-
 .../ambari/server/controller/AmbariServer.java  |   2 +
 .../internal/AbstractProviderModule.java        |  41 ++++--
 .../internal/AlertSummaryPropertyProvider.java  | 134 +++++++++++++++++++
 .../nagios/NagiosPropertyProvider.java          |  27 ++--
 .../ambari/server/orm/dao/AlertSummaryDTO.java  |  70 ++++++++++
 .../apache/ambari/server/orm/dao/AlertsDAO.java |  50 +++++++
 .../nagios/NagiosPropertyProviderTest.java      |  80 +++++------
 .../ambari/server/orm/dao/AlertsDAOTest.java    |  75 ++++++++++-
 .../app/controllers/global/update_controller.js |   4 +-
 .../app/controllers/main/alerts_controller.js   |   4 +-
 ambari-web/app/controllers/main/host.js         |   4 +-
 ambari-web/app/mappers/hosts_mapper.js          |   2 +-
 ambari-web/app/mappers/service_mapper.js        |   8 +-
 ambari-web/app/utils/ajax/ajax.js               |   6 +-
 .../controllers/main/alerts_controller_test.js  |  28 ++--
 20 files changed, 450 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/api/resources/AlertResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/AlertResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/AlertResourceDefinition.java
index afdbcfc..d7aca22 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/AlertResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/AlertResourceDefinition.java
@@ -30,12 +30,12 @@ public class AlertResourceDefinition extends BaseResourceDefinition {
   
   @Override
   public String getPluralName() {
-    return "alerts_data";
+    return "alerts";
   }
   
   @Override
   public String getSingularName() {
-    return "alert_data";
+    return "alert";
   }
   
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java
index 8e163c2..a916c4c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java
@@ -52,7 +52,7 @@ public class AlertService extends BaseService {
    */
   @GET
   @Produces("text/plain")
-  public Response getDefinitions(String body,
+  public Response getAlerts(String body,
       @Context HttpHeaders headers,
       @Context UriInfo ui) {
     return handleRequest(headers, body, ui, Request.Type.GET,
@@ -66,7 +66,7 @@ public class AlertService extends BaseService {
   @GET
   @Path("{alertId}")
   @Produces("text/plain")
-  public Response getDefinition(String body,
+  public Response getAlert(String body,
       @Context HttpHeaders headers,
       @Context UriInfo ui,
       @PathParam("alertId") Long id) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/api/services/ClusterService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ClusterService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ClusterService.java
index c76acf7..a56bcbf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ClusterService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ClusterService.java
@@ -366,7 +366,7 @@ public class ClusterService extends BaseService {
    *
    * @return  the alert definition service
    */
-  @Path("{clusterName}/alerts_data")
+  @Path("{clusterName}/alerts")
   public AlertService getAlertService(
       @Context javax.ws.rs.core.Request request, @PathParam("clusterName") String clusterName) {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java
index 8cec7e1..7962ee3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java
@@ -212,7 +212,7 @@ public class HostService extends BaseService {
    * @param hostName host id
    * @return the alerts service
    */
-  @Path("{hostName}/alerts_data")
+  @Path("{hostName}/alerts")
   public AlertService getAlertHandler(@PathParam("hostName") String hostName) {
     return new AlertService(m_clusterName, null, hostName);
   }  

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
index 30f4f2f..7371fad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
@@ -187,7 +187,7 @@ public class ServiceService extends BaseService {
   /**
    * Gets the alerts sub-resource.
    */
-  @Path("{serviceName}/alerts_data")
+  @Path("{serviceName}/alerts")
   public AlertService getAlertHandler(
       @PathParam("serviceName") String serviceName) {
     return new AlertService(m_clusterName, serviceName, null);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 73e4013..4cae67e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -48,6 +48,7 @@ import org.apache.ambari.server.controller.internal.AbstractControllerResourcePr
 import org.apache.ambari.server.controller.internal.AlertDefinitionResourceProvider;
 import org.apache.ambari.server.controller.internal.AlertGroupResourceProvider;
 import org.apache.ambari.server.controller.internal.AlertResourceProvider;
+import org.apache.ambari.server.controller.internal.AlertSummaryPropertyProvider;
 import org.apache.ambari.server.controller.internal.AlertTargetResourceProvider;
 import org.apache.ambari.server.controller.internal.AmbariPrivilegeResourceProvider;
 import org.apache.ambari.server.controller.internal.BlueprintResourceProvider;
@@ -535,6 +536,7 @@ public class AmbariServer {
     AlertResourceProvider.init(injector);
     AlertDefinitionResourceProvider.init(injector);
     AlertGroupResourceProvider.init(injector);
+    AlertSummaryPropertyProvider.init(injector);
     AlertTargetResourceProvider.init(injector);
     PermissionResourceProvider.init(injector.getInstance(PermissionDAO.class));
     ViewPermissionResourceProvider.init(injector.getInstance(PermissionDAO.class));

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index fc60210..f50955c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -18,9 +18,21 @@
 
 package org.apache.ambari.server.controller.internal;
 
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.Role;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
+import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.AmbariServer;
 import org.apache.ambari.server.controller.HostRequest;
 import org.apache.ambari.server.controller.HostResponse;
@@ -29,30 +41,33 @@ import org.apache.ambari.server.controller.ServiceComponentHostResponse;
 import org.apache.ambari.server.controller.ganglia.GangliaComponentPropertyProvider;
 import org.apache.ambari.server.controller.ganglia.GangliaHostComponentPropertyProvider;
 import org.apache.ambari.server.controller.ganglia.GangliaHostPropertyProvider;
-import org.apache.ambari.server.controller.ganglia.GangliaReportPropertyProvider;
 import org.apache.ambari.server.controller.ganglia.GangliaHostProvider;
+import org.apache.ambari.server.controller.ganglia.GangliaReportPropertyProvider;
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.controller.jmx.JMXPropertyProvider;
 import org.apache.ambari.server.controller.nagios.NagiosPropertyProvider;
-import org.apache.ambari.server.controller.spi.*;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.PropertyProvider;
+import org.apache.ambari.server.controller.spi.ProviderModule;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PredicateBuilder;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.controller.AmbariManagementController;
-
-import com.google.inject.Inject;
-
 import org.apache.ambari.server.controller.utilities.StreamProvider;
+import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.State;
-import org.apache.ambari.server.state.Cluster;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
+import com.google.inject.Inject;
 
 /**
  * An abstract provider module implementation.
@@ -422,6 +437,8 @@ public abstract class AbstractProviderModule implements ProviderModule, Resource
                 configuration),
               "Clusters/cluster_name",
               "Clusters/version"));
+          providers.add(new AlertSummaryPropertyProvider(type,
+              "Clusters/cluster_name", null));
           break;
         case Service:
           providers.add(new NagiosPropertyProvider(type,
@@ -430,6 +447,8 @@ public abstract class AbstractProviderModule implements ProviderModule, Resource
                 configuration),
               "ServiceInfo/cluster_name",
               "ServiceInfo/service_name"));
+          providers.add(new AlertSummaryPropertyProvider(type,
+              "ServiceInfo/cluster_name", "ServiceInfo/service_name"));
           break;
         case Host:
           providers.add(createGangliaHostPropertyProvider(
@@ -446,6 +465,8 @@ public abstract class AbstractProviderModule implements ProviderModule, Resource
                 configuration),
               "Hosts/cluster_name",
               "Hosts/host_name"));
+          providers.add(new AlertSummaryPropertyProvider(type,
+              "Hosts/cluster_name", "Hosts/host_name"));
           break;
         case Component: {
           // TODO as we fill out stack metric definitions, these can be phased out

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertSummaryPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertSummaryPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertSummaryPropertyProvider.java
new file mode 100644
index 0000000..438d471
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertSummaryPropertyProvider.java
@@ -0,0 +1,134 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.internal;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.PropertyProvider;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.orm.dao.AlertSummaryDTO;
+import org.apache.ambari.server.orm.dao.AlertsDAO;
+import org.apache.ambari.server.state.AlertState;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Injector;
+
+/**
+ * Property provider that adds alert summary information to endpoints.
+ */
+public class AlertSummaryPropertyProvider extends BaseProvider implements PropertyProvider {
+
+  private final static Logger LOG = LoggerFactory.getLogger(AlertSummaryPropertyProvider.class);
+  
+  private static Clusters s_clusters = null;
+  private static AlertsDAO s_dao = null;
+  
+  private Resource.Type m_resourceType = null;
+  private String m_clusterPropertyId = null;
+  private String m_typeIdPropertyId = null;
+  
+  AlertSummaryPropertyProvider(Resource.Type type,
+      String clusterPropertyId, String typeIdPropertyId) {
+    super(Collections.singleton("alerts_summary"));
+    m_resourceType = type;
+    m_clusterPropertyId = clusterPropertyId;
+    m_typeIdPropertyId = typeIdPropertyId;
+  }
+  
+  public static void init(Injector injector) {
+    s_clusters = injector.getInstance(Clusters.class);
+    s_dao = injector.getInstance(AlertsDAO.class);
+  }
+
+  @Override
+  public Set<Resource> populateResources(Set<Resource> resources,
+      Request request, Predicate predicate) throws SystemException {
+
+    Set<String> propertyIds = getRequestPropertyIds(request, predicate);
+
+    try {
+      for (Resource res : resources) {
+        populateResource(res, propertyIds);
+      }
+    } catch (AmbariException e) {
+      LOG.error("Could not load built-in alerts - Executor exception ({})",
+          e.getMessage());
+    }
+    
+    return resources;
+  }
+  
+  private void populateResource(Resource resource, Set<String> requestedIds) throws AmbariException {
+
+    AlertSummaryDTO summary = null;
+
+    String clusterName = (String) resource.getPropertyValue(m_clusterPropertyId);
+    String typeId = null == m_typeIdPropertyId ? null : (String) resource.getPropertyValue(m_typeIdPropertyId);
+    Cluster cluster = s_clusters.getCluster(clusterName);
+    
+    switch (m_resourceType.getInternalType()) {
+      case Cluster:
+        summary = s_dao.findCurrentCounts(cluster.getClusterId(), null, null);
+        break;
+      case Service:
+        summary = s_dao.findCurrentCounts(cluster.getClusterId(), typeId, null);
+        break;
+      case Host:
+        summary = s_dao.findCurrentCounts(cluster.getClusterId(), null, typeId);
+        break;
+      default:
+        break;
+    }
+    
+    if (null != summary) {
+      Map<AlertState, Integer> map = new HashMap<AlertState, Integer>();
+      map.put(AlertState.OK, Integer.valueOf(summary.getOkCount()));
+      map.put(AlertState.WARNING, Integer.valueOf(summary.getWarningCount()));
+      map.put(AlertState.CRITICAL, Integer.valueOf(summary.getCriticalCount()));
+      map.put(AlertState.UNKNOWN, Integer.valueOf(summary.getUnknownCount()));
+      
+      setResourceProperty(resource, "alerts_summary", map, requestedIds);
+    }
+      
+  }
+
+  @Override
+  public Set<String> checkPropertyIds(Set<String> propertyIds) {
+    Set<String> rejects = new HashSet<String>();
+    
+    for (String id : propertyIds) {
+      if (!id.startsWith("alerts_summary"))
+        rejects.add(id);
+    }
+    
+    return rejects;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
index d2e425f..5b93db8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
@@ -17,14 +17,10 @@
  */
 package org.apache.ambari.server.controller.nagios;
 
-import com.google.gson.Gson;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -42,8 +38,8 @@ import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
 import java.util.regex.Pattern;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.configuration.Configuration;
@@ -54,7 +50,6 @@ import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
-import org.apache.ambari.server.state.Alert;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Service;
@@ -63,20 +58,26 @@ import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.gson.Gson;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
 /**
  * Used to populate resources that have Nagios alertable properties.
  */
+@Deprecated
 public class NagiosPropertyProvider extends BaseProvider implements PropertyProvider {
   
   private static final Logger LOG = LoggerFactory.getLogger(NagiosPropertyProvider.class);
   private static final Set<String> NAGIOS_PROPERTY_IDS = new HashSet<String>();
   private static final String NAGIOS_TEMPLATE = "http://%s/ambarinagios/nagios/nagios_alerts.php?q1=alerts&alert_type=all";
   
-  private static final String ALERT_DETAIL_PROPERTY_ID = "alerts/detail";
-  private static final String ALERT_SUMMARY_OK_PROPERTY_ID = "alerts/summary/OK";
-  private static final String ALERT_SUMMARY_WARNING_PROPERTY_ID = "alerts/summary/WARNING";
-  private static final String ALERT_SUMMARY_CRITICAL_PROPERTY_ID = "alerts/summary/CRITICAL";
-  private static final String ALERT_SUMMARY_PASSIVE_PROPERTY_ID = "alerts/summary/PASSIVE";
+  private static final String ALERT_DETAIL_PROPERTY_ID = "legacy_alerts/detail";
+  private static final String ALERT_SUMMARY_PROPERTY_ID = "legacy_alerts/summary";
+  private static final String ALERT_SUMMARY_OK_PROPERTY_ID = "legacy_alerts/summary/OK";
+  private static final String ALERT_SUMMARY_WARNING_PROPERTY_ID = "legacy_alerts/summary/WARNING";
+  private static final String ALERT_SUMMARY_CRITICAL_PROPERTY_ID = "legacy_alerts/summary/CRITICAL";
+  private static final String ALERT_SUMMARY_PASSIVE_PROPERTY_ID = "legacy_alerts/summary/PASSIVE";
   private static final String PASSIVE_TOKEN = "AMBARIPASSIVE=";
   
   private static final List<String> DEFAULT_IGNORABLE_FOR_SERVICES = Collections.unmodifiableList(new ArrayList<String>(
@@ -99,8 +100,8 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv
   private static final Set<String> CLUSTER_NAMES = new CopyOnWriteArraySet<String>();
   
   static {
-    NAGIOS_PROPERTY_IDS.add("alerts/summary");
-    NAGIOS_PROPERTY_IDS.add("alerts/detail");
+    NAGIOS_PROPERTY_IDS.add(ALERT_SUMMARY_PROPERTY_ID);
+    NAGIOS_PROPERTY_IDS.add(ALERT_DETAIL_PROPERTY_ID);
     IGNORABLE_FOR_SERVICES = new ArrayList<String>(DEFAULT_IGNORABLE_FOR_SERVICES);
 
     scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertSummaryDTO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertSummaryDTO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertSummaryDTO.java
new file mode 100644
index 0000000..80fa4e8
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertSummaryDTO.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.orm.dao;
+
+import org.apache.ambari.server.state.AlertState;
+
+/**
+ * Used to return alert summary data out of the database.
+ */
+public class AlertSummaryDTO {
+
+  private int okCount;
+  private int warningCount;
+  private int criticalCount;
+  private int unknownCount;
+  
+  /**
+   * Constructor, used by JPA.  JPA invokes this constructor, even if there
+   * are no records in the resultset.  In that case, all arguments are {@code null}.
+   */
+  public AlertSummaryDTO(Number ok, Number warning, Number critical, Number unknown) {
+    okCount = null == ok ? 0 : ok.intValue();
+    warningCount = null == warning ? 0 : warning.intValue();
+    criticalCount = null == critical ? 0 : critical.intValue();
+    unknownCount = null == unknown ? 0 : unknown.intValue();
+  }
+  
+  /**
+   * @return the count of {@link AlertState#OK} states
+   */
+  public int getOkCount() {
+    return okCount;
+  }
+  
+  /**
+   * @return the count of {@link AlertState#WARNING} states
+   */
+  public int getWarningCount() {
+    return warningCount;
+  }  
+  
+  /**
+   * @return the count of {@link AlertState#CRITICAL} states
+   */
+  public int getCriticalCount() {
+    return criticalCount;
+  }
+  
+  /**
+   * @return the count of {@link AlertState#UNKNOWN} states
+   */
+  public int getUnknownCount() {
+    return unknownCount;
+  }  
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
index 5fcc1ec..a274089 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
@@ -222,6 +222,55 @@ public class AlertsDAO {
     return daoUtils.selectList(query);
   }
   
+  /**
+   * Retrieves the summary information for a particular scope.  The result is a DTO
+   * since the columns are aggregated and don't fit to an entity.
+   * 
+   * @param clusterId the cluster id
+   * @param serviceName the service name. Use {@code null} to not filter on service.
+   * @param hostName the host name.  Use {@code null} to not filter on host.
+   * @return the summary DTO
+   */
+  @RequiresSession
+  public AlertSummaryDTO findCurrentCounts(long clusterId, String serviceName, String hostName) {
+    StringBuilder sb = new StringBuilder();
+    sb.append("SELECT NEW %s (");
+    sb.append("SUM(CASE WHEN history.alertState = %s.%s THEN 1 ELSE 0 END), ");
+    sb.append("SUM(CASE WHEN history.alertState = %s.%s THEN 1 ELSE 0 END), ");
+    sb.append("SUM(CASE WHEN history.alertState = %s.%s THEN 1 ELSE 0 END), ");
+    sb.append("SUM(CASE WHEN history.alertState = %s.%s THEN 1 ELSE 0 END)) ");
+    sb.append("FROM AlertCurrentEntity alert JOIN alert.alertHistory history WHERE history.clusterId = :clusterId");
+    
+    if (null != serviceName) {
+      sb.append(" AND history.serviceName = :serviceName");
+    }
+    
+    if (null != hostName) {
+      sb.append(" AND history.hostName = :hostName");
+    }
+    
+    String str = String.format(sb.toString(),
+        AlertSummaryDTO.class.getName(),
+        AlertState.class.getName(), AlertState.OK.name(),
+        AlertState.class.getName(), AlertState.WARNING.name(),
+        AlertState.class.getName(), AlertState.CRITICAL.name(),
+        AlertState.class.getName(), AlertState.UNKNOWN.name());
+    
+    TypedQuery<AlertSummaryDTO> query = entityManagerProvider.get().createQuery(
+        str, AlertSummaryDTO.class);
+    
+    query.setParameter("clusterId", Long.valueOf(clusterId));
+    
+    if (null != serviceName) {
+      query.setParameter("serviceName", serviceName);
+    }
+    
+    if (null != hostName) {
+      query.setParameter("hostName", hostName);
+    }
+    
+    return daoUtils.selectSingle(query);
+  }
   
   /**
    * Gets the current alerts for a given service.
@@ -408,4 +457,5 @@ public class AlertsDAO {
   public void remove(AlertCurrentEntity alert) {
     entityManagerProvider.get().remove(merge(alert));
   }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
index 4316dc9..8037451 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
@@ -124,7 +124,7 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertFalse("Expected no alerts", values.containsKey("alerts"));
+    Assert.assertFalse("Expected no alerts", values.containsKey("legacy_alerts"));
   }
 
 
@@ -176,9 +176,9 @@ public class NagiosPropertyProviderTest {
 
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
 
-    Assert.assertTrue(values.containsKey("alerts/summary"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
 
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertEquals(4L, summary.size());
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
@@ -230,7 +230,7 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertFalse("Expected no alerts", values.containsKey("alerts"));
+    Assert.assertFalse("Expected no alerts", values.containsKey("legacy_alerts"));
   }
   
   @Test
@@ -260,12 +260,12 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertTrue(values.containsKey("alerts"));
-    Assert.assertTrue(values.containsKey("alerts/summary"));
-    Assert.assertTrue(values.get("alerts").containsKey("detail"));
-    Assert.assertTrue(List.class.isInstance(values.get("alerts").get("detail")));
+    Assert.assertTrue(values.containsKey("legacy_alerts"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
+    Assert.assertTrue(values.get("legacy_alerts").containsKey("detail"));
+    Assert.assertTrue(List.class.isInstance(values.get("legacy_alerts").get("detail")));
     
-    List<?> list = (List<?>) values.get("alerts").get("detail");
+    List<?> list = (List<?>) values.get("legacy_alerts").get("detail");
     Assert.assertEquals(Integer.valueOf(3), Integer.valueOf(list.size()));
     for (Object o : list) {
       Assert.assertTrue(Map.class.isInstance(o));
@@ -275,7 +275,7 @@ public class NagiosPropertyProviderTest {
       Assert.assertTrue("expected HBASE", serviceName.equals("HBASE"));
     }
     
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
     Assert.assertTrue(summary.containsKey("CRITICAL"));
@@ -311,12 +311,12 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertTrue(values.containsKey("alerts"));
-    Assert.assertTrue(values.containsKey("alerts/summary"));
-    Assert.assertTrue(values.get("alerts").containsKey("detail"));
-    Assert.assertTrue(List.class.isInstance(values.get("alerts").get("detail")));
+    Assert.assertTrue(values.containsKey("legacy_alerts"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
+    Assert.assertTrue(values.get("legacy_alerts").containsKey("detail"));
+    Assert.assertTrue(List.class.isInstance(values.get("legacy_alerts").get("detail")));
     
-    List<?> list = (List<?>) values.get("alerts").get("detail");
+    List<?> list = (List<?>) values.get("legacy_alerts").get("detail");
     Assert.assertTrue(7 == list.size());
     for (Object o : list) {
       Assert.assertTrue(Map.class.isInstance(o));
@@ -326,7 +326,7 @@ public class NagiosPropertyProviderTest {
       Assert.assertTrue("expected c6403.ambari.apache.org", host.equals("c6403.ambari.apache.org"));
     }
     
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
     Assert.assertTrue(summary.containsKey("CRITICAL"));
@@ -362,12 +362,12 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertTrue(values.containsKey("alerts"));
-    Assert.assertTrue(values.containsKey("alerts/summary"));
-    Assert.assertTrue(values.get("alerts").containsKey("detail"));
-    Assert.assertTrue(List.class.isInstance(values.get("alerts").get("detail")));
+    Assert.assertTrue(values.containsKey("legacy_alerts"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
+    Assert.assertTrue(values.get("legacy_alerts").containsKey("detail"));
+    Assert.assertTrue(List.class.isInstance(values.get("legacy_alerts").get("detail")));
     
-    List<?> list = (List<?>) values.get("alerts").get("detail");
+    List<?> list = (List<?>) values.get("legacy_alerts").get("detail");
     Assert.assertEquals(Integer.valueOf(16), Integer.valueOf(list.size()));
     for (Object o : list) {
       Assert.assertTrue(Map.class.isInstance(o));
@@ -377,7 +377,7 @@ public class NagiosPropertyProviderTest {
       Assert.assertEquals("c6401.ambari.apache.org", host);
     }
     
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
     Assert.assertTrue(summary.containsKey("CRITICAL"));
@@ -417,12 +417,12 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertTrue(values.containsKey("alerts"));
-    Assert.assertTrue(values.containsKey("alerts/summary"));
-    Assert.assertTrue(values.get("alerts").containsKey("detail"));
-    Assert.assertTrue(List.class.isInstance(values.get("alerts").get("detail")));
+    Assert.assertTrue(values.containsKey("legacy_alerts"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
+    Assert.assertTrue(values.get("legacy_alerts").containsKey("detail"));
+    Assert.assertTrue(List.class.isInstance(values.get("legacy_alerts").get("detail")));
     
-    List<?> list = (List<?>) values.get("alerts").get("detail");
+    List<?> list = (List<?>) values.get("legacy_alerts").get("detail");
     // removed an additional one
     Assert.assertEquals(Integer.valueOf(2), Integer.valueOf(list.size()));
     for (Object o : list) {
@@ -433,7 +433,7 @@ public class NagiosPropertyProviderTest {
       Assert.assertTrue("expected HBASE", serviceName.equals("HBASE"));
     }
     
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
     Assert.assertTrue(summary.containsKey("CRITICAL"));
@@ -490,12 +490,12 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertTrue(values.containsKey("alerts"));
-    Assert.assertTrue(values.containsKey("alerts/summary"));
-    Assert.assertTrue(values.get("alerts").containsKey("detail"));
-    Assert.assertTrue(List.class.isInstance(values.get("alerts").get("detail")));
+    Assert.assertTrue(values.containsKey("legacy_alerts"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
+    Assert.assertTrue(values.get("legacy_alerts").containsKey("detail"));
+    Assert.assertTrue(List.class.isInstance(values.get("legacy_alerts").get("detail")));
     
-    List<?> list = (List<?>) values.get("alerts").get("detail");
+    List<?> list = (List<?>) values.get("legacy_alerts").get("detail");
     // removed an additional one
     Assert.assertEquals(Integer.valueOf(4), Integer.valueOf(list.size()));
     for (Object o : list) {
@@ -506,7 +506,7 @@ public class NagiosPropertyProviderTest {
       Assert.assertEquals(serviceName, "GANGLIA");
     }
     
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
     Assert.assertTrue(summary.containsKey("CRITICAL"));
@@ -543,12 +543,12 @@ public class NagiosPropertyProviderTest {
     
     Map<String, Map<String, Object>> values = res.getPropertiesMap();
     
-    Assert.assertTrue(values.containsKey("alerts"));
-    Assert.assertTrue(values.containsKey("alerts/summary"));
-    Assert.assertTrue(values.get("alerts").containsKey("detail"));
-    Assert.assertTrue(List.class.isInstance(values.get("alerts").get("detail")));
+    Assert.assertTrue(values.containsKey("legacy_alerts"));
+    Assert.assertTrue(values.containsKey("legacy_alerts/summary"));
+    Assert.assertTrue(values.get("legacy_alerts").containsKey("detail"));
+    Assert.assertTrue(List.class.isInstance(values.get("legacy_alerts").get("detail")));
     
-    List<?> list = (List<?>) values.get("alerts").get("detail");
+    List<?> list = (List<?>) values.get("legacy_alerts").get("detail");
     Assert.assertEquals(Integer.valueOf(1), Integer.valueOf(list.size()));
     for (Object o : list) {
       Assert.assertTrue(Map.class.isInstance(o));
@@ -558,7 +558,7 @@ public class NagiosPropertyProviderTest {
       Assert.assertEquals("c6404.ambari.apache.org", host);
     }
     
-    Map<String, Object> summary = values.get("alerts/summary");
+    Map<String, Object> summary = values.get("legacy_alerts/summary");
     Assert.assertTrue(summary.containsKey("OK"));
     Assert.assertTrue(summary.containsKey("WARNING"));
     Assert.assertTrue(summary.containsKey("CRITICAL"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java
index 7c206a2..a397da4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java
@@ -229,7 +229,6 @@ public class AlertsDAOTest {
     current.setAlertHistory(history);
     dao.create(current);
     
-    
     List<AlertCurrentEntity> currentAlerts = dao.findCurrentByHost(clusterId, history.getHostName());
 
     assertNotNull(currentAlerts);
@@ -323,4 +322,78 @@ public class AlertsDAOTest {
     assertNotNull(entity.getAlertHistory());
     assertNotNull(entity.getAlertHistory().getAlertDefinition());
   }
+  
+  /**
+   * 
+   */
+  @Test
+  public void testFindCurrentSummary() throws Exception {
+    AlertSummaryDTO summary = dao.findCurrentCounts(clusterId.longValue(), null, null);
+    assertEquals(5, summary.getOkCount());
+
+    AlertHistoryEntity h1 = dao.findCurrentByCluster(clusterId.longValue()).get(2).getAlertHistory();
+    AlertHistoryEntity h2 = dao.findCurrentByCluster(clusterId.longValue()).get(3).getAlertHistory();
+    AlertHistoryEntity h3 = dao.findCurrentByCluster(clusterId.longValue()).get(4).getAlertHistory();
+    h1.setAlertState(AlertState.WARNING);
+    dao.merge(h1);
+    h2.setAlertState(AlertState.CRITICAL);
+    dao.merge(h2);
+    h3.setAlertState(AlertState.UNKNOWN);
+    dao.merge(h3);
+    
+    int ok = 0;
+    int warn = 0;
+    int crit = 0;
+    int unk = 0;
+    
+    for (AlertCurrentEntity h : dao.findCurrentByCluster(clusterId.longValue())) {
+      switch (h.getAlertHistory().getAlertState()) {
+        case CRITICAL:
+          crit++;
+          break;
+        case OK:
+          ok++;
+          break;
+        case UNKNOWN:
+          unk++;
+          break;
+        default:
+          warn++;
+          break;
+      }
+        
+    }
+      
+    summary = dao.findCurrentCounts(clusterId.longValue(), null, null);
+    // !!! db-to-db compare
+    assertEquals(ok, summary.getOkCount());
+    assertEquals(warn, summary.getWarningCount());
+    assertEquals(crit, summary.getCriticalCount());
+    assertEquals(unk, summary.getCriticalCount());
+    
+    // !!! expected
+    assertEquals(2, summary.getOkCount());
+    assertEquals(1, summary.getWarningCount());
+    assertEquals(1, summary.getCriticalCount());
+    assertEquals(1, summary.getCriticalCount());
+    
+    summary = dao.findCurrentCounts(clusterId.longValue(), "Service 0", null);
+    assertEquals(1, summary.getOkCount());
+    assertEquals(0, summary.getWarningCount());
+    assertEquals(0, summary.getCriticalCount());
+    assertEquals(0, summary.getCriticalCount());
+
+    summary = dao.findCurrentCounts(clusterId.longValue(), null, "h1");
+    assertEquals(2, summary.getOkCount());
+    assertEquals(1, summary.getWarningCount());
+    assertEquals(1, summary.getCriticalCount());
+    assertEquals(1, summary.getCriticalCount());
+    
+    summary = dao.findCurrentCounts(clusterId.longValue(), "foo", null);
+    assertEquals(0, summary.getOkCount());
+    assertEquals(0, summary.getWarningCount());
+    assertEquals(0, summary.getCriticalCount());
+    assertEquals(0, summary.getCriticalCount());
+    
+  }  
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index a71f689..35b9e13 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -154,7 +154,7 @@ App.UpdateController = Em.Controller.extend({
     var realUrl = '/hosts?<parameters>fields=Hosts/host_name,Hosts/maintenance_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,' +
       'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,' +
       'host_components/HostRoles/stale_configs,host_components/HostRoles/service_name,metrics/disk,metrics/load/load_one,Hosts/total_mem,' +
-      'alerts/summary<hostAuxiliaryInfo>&minimal_response=true';
+      'legacy_alerts/summary<hostAuxiliaryInfo>&minimal_response=true';
     var hostAuxiliaryInfo = ',Hosts/os_arch,Hosts/os_type,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free';
 
     if (App.router.get('currentState.name') == 'index' && App.router.get('currentState.parentState.name') == 'hosts') {
@@ -423,7 +423,7 @@ App.UpdateController = Em.Controller.extend({
   },
   updateServices: function (callback) {
     var testUrl = '/data/services/HDP2/services.json';
-    var componentConfigUrl = this.getUrl(testUrl, '/services?fields=alerts/summary,ServiceInfo/state,ServiceInfo/maintenance_state&minimal_response=true');
+    var componentConfigUrl = this.getUrl(testUrl, '/services?fields=legacy_alerts/summary,ServiceInfo/state,ServiceInfo/maintenance_state&minimal_response=true');
     App.HttpClient.get(componentConfigUrl, App.serviceMapper, {
       complete: callback
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/app/controllers/main/alerts_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts_controller.js b/ambari-web/app/controllers/main/alerts_controller.js
index 0ea7212..2504ca1 100644
--- a/ambari-web/app/controllers/main/alerts_controller.js
+++ b/ambari-web/app/controllers/main/alerts_controller.js
@@ -139,8 +139,8 @@ App.MainAlertsController = Em.Controller.extend({
    */
   getAlertsSuccessCallback: function (json) {
     var alerts = [];
-    if (json && json.alerts && json.alerts.detail) {
-      json.alerts.detail.forEach(function (_alert) {
+    if (json && json.legacy_alerts && json.legacy_alerts.detail) {
+      json.legacy_alerts.detail.forEach(function (_alert) {
         alerts.pushObject(App.Alert.create({
           title: _alert.description,
           serviceType: _alert.service_name,

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 227a091..ae36158 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -122,7 +122,7 @@ App.MainHostController = Em.ArrayController.extend({
     },
     {
       key: 'criticalAlertsCount',
-      alias: 'alerts/summary/CRITICAL{0}|alerts/summary/WARNING{1}',
+      alias: 'legacy_alerts/summary/CRITICAL{0}|legacy_alerts/summary/WARNING{1}',
       type: 'CUSTOM'
     },
     {
@@ -368,7 +368,7 @@ App.MainHostController = Em.ArrayController.extend({
       'UNHEALTHY': data.Clusters.health_report['Host/host_status/UNHEALTHY'],
       'ALERT': data.Clusters.health_report['Host/host_status/ALERT'],
       'UNKNOWN': data.Clusters.health_report['Host/host_status/UNKNOWN'],
-      'health-status-WITH-ALERTS': (data.alerts) ? data.alerts.summary.CRITICAL + data.alerts.summary.WARNING : 0,
+      'health-status-WITH-ALERTS': (data.legacy_alerts) ? data.legacy_alerts.summary.CRITICAL + data.legacy_alerts.summary.WARNING : 0,
       'health-status-RESTART': data.Clusters.health_report['Host/stale_config'],
       'health-status-PASSIVE_STATE': data.Clusters.health_report['Host/maintenance_state'],
       'TOTAL': data.Clusters.total_hosts

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 05037f2..241ea88 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -92,7 +92,7 @@ App.hostsMapper = App.QuickDataMapper.create({
           }
           serviceToHostComponentIdMap[serviceName].push(component.id);
         }, this);
-        item.critical_alerts_count = (item.alerts) ? item.alerts.summary.CRITICAL + item.alerts.summary.WARNING : 0;
+        item.critical_alerts_count = (item.legacy_alerts) ? item.legacy_alerts.summary.CRITICAL + item.legacy_alerts.summary.WARNING : 0;
         item.cluster_id = App.get('clusterName');
         item.index = index;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/app/mappers/service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js
index 00680a3..12f65f3 100644
--- a/ambari-web/app/mappers/service_mapper.js
+++ b/ambari-web/app/mappers/service_mapper.js
@@ -30,8 +30,8 @@ App.serviceMapper = App.QuickDataMapper.create({
         cachedService.ServiceInfo.passive_state = service.ServiceInfo.maintenance_state;
 
         //check whether Nagios installed and started
-        if (service.alerts) {
-          cachedService.ServiceInfo.critical_alerts_count = service.alerts.summary.CRITICAL + service.alerts.summary.WARNING;
+        if (service.legacy_alerts) {
+          cachedService.ServiceInfo.critical_alerts_count = service.legacy_alerts.summary.CRITICAL + service.legacy_alerts.summary.WARNING;
         }
       } else {
         var serviceData = {
@@ -45,8 +45,8 @@ App.serviceMapper = App.QuickDataMapper.create({
         };
 
         //check whether Nagios installed and started
-        if (service.alerts) {
-          serviceData.ServiceInfo.critical_alerts_count = service.alerts.summary.CRITICAL + service.alerts.summary.WARNING;
+        if (service.legacy_alerts) {
+          serviceData.ServiceInfo.critical_alerts_count = service.legacy_alerts.summary.CRITICAL + service.legacy_alerts.summary.WARNING;
         }
         App.cache['services'].push(serviceData);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 3d1fda9..b787a2e 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -291,11 +291,11 @@ var urls = {
   },
 
   'alerts.get_by_service': {
-    'real': '/clusters/{clusterName}/services/{serviceName}?fields=alerts',
+    'real': '/clusters/{clusterName}/services/{serviceName}?fields=legacy_alerts',
     'mock': '/data/alerts/HDP2/service_alerts.json'
   },
   'alerts.get_by_host': {
-    'real': '/clusters/{clusterName}/hosts/{hostName}?fields=alerts',
+    'real': '/clusters/{clusterName}/hosts/{hostName}?fields=legacy_alerts',
     'mock': '/data/alerts/HDP2/host_alerts.json'
   },
   'background_operations.get_most_recent': {
@@ -1747,7 +1747,7 @@ var urls = {
     }
   },
   'host.status.counters': {
-    'real': '/clusters/{clusterName}?fields=alerts,Clusters/health_report,Clusters/total_hosts&minimal_response=true',
+    'real': '/clusters/{clusterName}?fields=legacy_alerts,Clusters/health_report,Clusters/total_hosts&minimal_response=true',
     'mock': '/data/hosts/HDP2/host_status_counters.json'
   },
   'components.filter_by_status': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1059cf/ambari-web/test/controllers/main/alerts_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts_controller_test.js b/ambari-web/test/controllers/main/alerts_controller_test.js
index 3a3dc7f..aee782a 100644
--- a/ambari-web/test/controllers/main/alerts_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts_controller_test.js
@@ -171,18 +171,18 @@ describe('MainAlertsController', function () {
         result: []
       },
       {
-        title: 'data.alerts is null',
-        data: {alerts: null},
+        title: 'data.legacy_alerts is null',
+        data: {legacy_alerts: null},
         result: []
       },
       {
-        title: 'data.alerts.detail is null',
-        data: {alerts: {detail: null}},
+        title: 'data.legacy_alerts.detail is null',
+        data: {legacy_alerts: {detail: null}},
         result: []
       },
       {
-        title: 'data.alerts.detail is empty',
-        data: {alerts: {detail: []}},
+        title: 'data.legacy_alerts.detail is empty',
+        data: {legacy_alerts: {detail: []}},
         result: []
       }
     ];
@@ -195,7 +195,7 @@ describe('MainAlertsController', function () {
       });
     });
 
-    var data = {alerts: {detail: [
+    var data = {legacy_alerts: {detail: [
       {
         description: 't1',
         service_name: "s1",
@@ -208,27 +208,27 @@ describe('MainAlertsController', function () {
     ]}};
     var testCasesOfStatus = [
       {
-        title: 'data.alerts.detail is correct, OK status',
+        title: 'data.legacy_alerts.detail is correct, OK status',
         status: 'OK',
         result: '0'
       },
       {
-        title: 'data.alerts.detail is correct, WARNING status',
+        title: 'data.legacy_alerts.detail is correct, WARNING status',
         status: 'WARNING',
         result: '1'
       },
       {
-        title: 'data.alerts.detail is correct, CRITICAL status',
+        title: 'data.legacy_alerts.detail is correct, CRITICAL status',
         status: 'CRITICAL',
         result: '2'
       },
       {
-        title: 'data.alerts.detail is correct, PASSIVE status',
+        title: 'data.legacy_alerts.detail is correct, PASSIVE status',
         status: 'PASSIVE',
         result: '3'
       },
       {
-        title: 'data.alerts.detail is correct, unknown status',
+        title: 'data.legacy_alerts.detail is correct, unknown status',
         status: '',
         result: '4'
       }
@@ -236,7 +236,7 @@ describe('MainAlertsController', function () {
     testCasesOfStatus.forEach(function (test) {
       it(test.title, function () {
         controller.set('isLoaded', false);
-        data.alerts.detail[0].status = test.status;
+        data.legacy_alerts.detail[0].status = test.status;
         controller.getAlertsSuccessCallback(data);
         expect(controller.get('alerts.length')).to.equal(1);
         expect(controller.get('alerts').objectAt(0).get('status')).to.equal(test.result);
@@ -257,4 +257,4 @@ describe('MainAlertsController', function () {
       expect(controller.get('isLoaded')).to.be.true;
     });
   });
-});
\ No newline at end of file
+});


Mime
View raw message