Parcourir la source

AMBARI-12046. Aggregate alerts not working. (mpapirkovskyy)

Myroslav Papirkovskyy il y a 10 ans
Parent
commit
71617d03db

+ 1 - 0
ambari-server/src/main/java/org/apache/ambari/server/alerts/AgentHeartbeatAlertRunnable.java

@@ -170,6 +170,7 @@ public class AgentHeartbeatAlertRunnable implements Runnable {
           alert.setLabel(entity.getLabel());
           alert.setText(alertText);
           alert.setTimestamp(alertTimestamp);
+          alert.setCluster(cluster.getClusterName());
 
           AlertReceivedEvent event = new AlertReceivedEvent(
               cluster.getClusterId(), alert);

+ 1 - 0
ambari-server/src/main/java/org/apache/ambari/server/alerts/StaleAlertRunnable.java

@@ -197,6 +197,7 @@ public class StaleAlertRunnable implements Runnable {
         alert.setLabel(entity.getLabel());
         alert.setText(alertText);
         alert.setTimestamp(now);
+        alert.setCluster(cluster.getClusterName());
 
         AlertReceivedEvent event = new AlertReceivedEvent(
             cluster.getClusterId(), alert);

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java

@@ -123,8 +123,8 @@ public class AlertReceivedListener {
 
       Long clusterId = getClusterIdByName(alert.getCluster());
       if (clusterId == null) {
-        LOG.warn("Null cluster id is not supported for alerts as of now"); //based on listener implementation
-        continue;
+        //check event
+        clusterId = event.getClusterId();
       }
 
       AlertDefinitionEntity definition = m_definitionDao.findByName(clusterId,