@@ -261,7 +261,7 @@ public void sendAlert(short alertType, long dataCenterId, Long podId, String sub
261261 // shouldn't we have a type/severity as part of the API so that severe errors get sent right away?
262262 try {
263263 if (_emailAlert != null ) {
264- _emailAlert .sendAlert (alertType , dataCenterId , podId , subject , body );
264+ _emailAlert .sendAlert (alertType , dataCenterId , podId , null , subject , body );
265265 }
266266 } catch (Exception ex ) {
267267 s_logger .error ("Problem sending email alert" , ex );
@@ -503,6 +503,8 @@ private void generateEmailAlert(DataCenterVO dc, HostPodVO pod, ClusterVO cluste
503503 String usedStr ;
504504 String pctStr = formatPercent (usedCapacity /totalCapacity );
505505 short alertType = -1 ;
506+ Long podId = pod == null ? null : pod .getId ();
507+ Long clusterId = cluster == null ? null : cluster .getId ();
506508
507509 switch (capacityType ) {
508510
@@ -584,7 +586,7 @@ private void generateEmailAlert(DataCenterVO dc, HostPodVO pod, ClusterVO cluste
584586 }
585587
586588 try {
587- _emailAlert .sendAlert (alertType , dc .getId (), null , msgSubject , msgContent );
589+ _emailAlert .sendAlert (alertType , dc .getId (), podId , clusterId , msgSubject , msgContent );
588590 } catch (Exception ex ) {
589591 s_logger .error ("Exception in CapacityChecker" , ex );
590592 }
@@ -683,22 +685,23 @@ protected PasswordAuthentication getPasswordAuthentication() {
683685 }
684686
685687 // TODO: make sure this handles SSL transport (useAuth is true) and regular
686- public void sendAlert (short alertType , long dataCenterId , Long podId , String subject , String content ) throws MessagingException , UnsupportedEncodingException {
688+ public void sendAlert (short alertType , long dataCenterId , Long podId , Long clusterId , String subject , String content ) throws MessagingException , UnsupportedEncodingException {
687689 AlertVO alert = null ;
688690 if ((alertType != AlertManager .ALERT_TYPE_HOST ) &&
689691 (alertType != AlertManager .ALERT_TYPE_USERVM ) &&
690692 (alertType != AlertManager .ALERT_TYPE_DOMAIN_ROUTER ) &&
691693 (alertType != AlertManager .ALERT_TYPE_CONSOLE_PROXY ) &&
692694 (alertType != AlertManager .ALERT_TYPE_STORAGE_MISC ) &&
693695 (alertType != AlertManager .ALERT_TYPE_MANAGMENT_NODE )) {
694- alert = _alertDao .getLastAlert (alertType , dataCenterId , podId );
696+ alert = _alertDao .getLastAlert (alertType , dataCenterId , podId , clusterId );
695697 }
696698
697699 if (alert == null ) {
698700 // set up a new alert
699701 AlertVO newAlert = new AlertVO ();
700702 newAlert .setType (alertType );
701- newAlert .setSubject (subject );
703+ newAlert .setSubject (subject );
704+ newAlert .setClusterId (clusterId );
702705 newAlert .setPodId (podId );
703706 newAlert .setDataCenterId (dataCenterId );
704707 newAlert .setSentCount (1 ); // initialize sent count to 1 since we are now sending an alert
@@ -737,7 +740,7 @@ public void sendAlert(short alertType, long dataCenterId, Long podId, String sub
737740
738741 public void clearAlert (short alertType , long dataCenterId , Long podId ) {
739742 if (alertType != -1 ) {
740- AlertVO alert = _alertDao .getLastAlert (alertType , dataCenterId , podId );
743+ AlertVO alert = _alertDao .getLastAlert (alertType , dataCenterId , podId , null );
741744 if (alert != null ) {
742745 AlertVO updatedAlert = _alertDao .createForUpdate ();
743746 updatedAlert .setResolved (new Date ());
0 commit comments