You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Jonathan Hurley <jh...@hortonworks.com> on 2014/09/23 17:44:53 UTC

Review Request 25940: Alerts: Implement Email Dispatcher

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25940/
-----------------------------------------------------------

Review request for Ambari and Nate Cole.


Bugs: AMBARI-7443
    https://issues.apache.org/jira/browse/AMBARI-7443


Repository: ambari


Description
-------

Create an email dispatcher that can be used by the service that scans alert_notice for PENDING entries to relay notifications.

Alert targets of type EMAIL should be defined with a flat set of properties that governs the dispatching.

{code}
{
  "AlertTarget": {
    "name": "Email Test",
    "description": "The Admins",
    "notification_type": "EMAIL",
    "properties":{
      "ambari.dispatch.credential.username":"ambari",
      "ambari.dispatch.credential.password":"password",
      "ambari.dispatch.recipients":["ambari@repo.ambari.apache.org"],
      "mail.smtp.host":"repo.ambari.apache.org",
      "mail.smtp.port":"25",
      "mail.smtp.auth":"true",
      "mail.smtp.tarttls.enable":"false",
      "mail.smtp.from":"ambari@repo.ambari.apache.org"
    }
  }
}
{code}

Several properties will be Ambari-specific and will be used for authentication and recipients:

- They will begin with {{ambari.dispatch}}
- {{ambari.dispatch.recipients}} will be a JSON array

The rest of the properties will be used by the concrete dispatcher. In this case, they will be JavaMail properties directly handed to the Properties instance used to initialize the JavaMail Session.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java f2b82d6eb3f68529b4c503599570b64e06a907ec 
  ambari-server/src/main/java/org/apache/ambari/server/events/AlertStateChangeEvent.java ab2c3dddcd8694f74adbd12e13233de6d9fe545e 
  ambari-server/src/main/java/org/apache/ambari/server/events/listeners/AlertReceivedListener.java fb7a6081b1920d1b459bbf4f58e31aa1cc575860 
  ambari-server/src/main/java/org/apache/ambari/server/events/listeners/AlertServiceStateListener.java f1ce617a7ae6f5bfe81e58c0d3b9d027f9f27275 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchCredentials.java PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 34140351134abf08d690504c4f9b439bbad9e634 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/Notification.java 08c52429c165f9b7fd28f8a576a4a6c7507d92c3 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/Recipient.java PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java d0858d32a93888f3113cda768574eb3a745e4d8b 
  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java aba41a5c2f16b62209fab373671f9ceca8e0c7b0 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java 5b54d5714526fe4b4772a4c5bdb70dc1f88dce3c 
  ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 7025e14163c0ea0d173a777e78c1e6d2c3a56da1 
  ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json 88503af7353b3b2974be1762147b0fcde4830e39 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java 1c964a33ae178a5675f623d48997e6e91783ab77 
  ambari-server/src/test/java/org/apache/ambari/server/notifications/EmailDispatcherTest.java PRE-CREATION 
  ambari-server/src/test/java/org/apache/ambari/server/notifications/MockDispatcher.java PRE-CREATION 
  ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java 9e638e832f1552c2e1d2b47953a3a2e5504d09c0 
  ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java PRE-CREATION 

Diff: https://reviews.apache.org/r/25940/diff/


Testing
-------

mvn clean test

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:08 min
[INFO] Finished at: 2014-09-23T00:09:01-07:00
[INFO] Final Memory: 29M/232M
[INFO] ------------------------------------------------------------------------


Thanks,

Jonathan Hurley


Re: Review Request 25940: Alerts: Implement Email Dispatcher

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25940/#review54276
-----------------------------------------------------------

Ship it!


Ship It!

- Nate Cole


On Sept. 23, 2014, 11:44 a.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/25940/
> -----------------------------------------------------------
> 
> (Updated Sept. 23, 2014, 11:44 a.m.)
> 
> 
> Review request for Ambari and Nate Cole.
> 
> 
> Bugs: AMBARI-7443
>     https://issues.apache.org/jira/browse/AMBARI-7443
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Create an email dispatcher that can be used by the service that scans alert_notice for PENDING entries to relay notifications.
> 
> Alert targets of type EMAIL should be defined with a flat set of properties that governs the dispatching.
> 
> {code}
> {
>   "AlertTarget": {
>     "name": "Email Test",
>     "description": "The Admins",
>     "notification_type": "EMAIL",
>     "properties":{
>       "ambari.dispatch.credential.username":"ambari",
>       "ambari.dispatch.credential.password":"password",
>       "ambari.dispatch.recipients":["ambari@repo.ambari.apache.org"],
>       "mail.smtp.host":"repo.ambari.apache.org",
>       "mail.smtp.port":"25",
>       "mail.smtp.auth":"true",
>       "mail.smtp.tarttls.enable":"false",
>       "mail.smtp.from":"ambari@repo.ambari.apache.org"
>     }
>   }
> }
> {code}
> 
> Several properties will be Ambari-specific and will be used for authentication and recipients:
> 
> - They will begin with {{ambari.dispatch}}
> - {{ambari.dispatch.recipients}} will be a JSON array
> 
> The rest of the properties will be used by the concrete dispatcher. In this case, they will be JavaMail properties directly handed to the Properties instance used to initialize the JavaMail Session.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java f2b82d6eb3f68529b4c503599570b64e06a907ec 
>   ambari-server/src/main/java/org/apache/ambari/server/events/AlertStateChangeEvent.java ab2c3dddcd8694f74adbd12e13233de6d9fe545e 
>   ambari-server/src/main/java/org/apache/ambari/server/events/listeners/AlertReceivedListener.java fb7a6081b1920d1b459bbf4f58e31aa1cc575860 
>   ambari-server/src/main/java/org/apache/ambari/server/events/listeners/AlertServiceStateListener.java f1ce617a7ae6f5bfe81e58c0d3b9d027f9f27275 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchCredentials.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 34140351134abf08d690504c4f9b439bbad9e634 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/Notification.java 08c52429c165f9b7fd28f8a576a4a6c7507d92c3 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/Recipient.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java d0858d32a93888f3113cda768574eb3a745e4d8b 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java aba41a5c2f16b62209fab373671f9ceca8e0c7b0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java 5b54d5714526fe4b4772a4c5bdb70dc1f88dce3c 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 7025e14163c0ea0d173a777e78c1e6d2c3a56da1 
>   ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json 88503af7353b3b2974be1762147b0fcde4830e39 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java 1c964a33ae178a5675f623d48997e6e91783ab77 
>   ambari-server/src/test/java/org/apache/ambari/server/notifications/EmailDispatcherTest.java PRE-CREATION 
>   ambari-server/src/test/java/org/apache/ambari/server/notifications/MockDispatcher.java PRE-CREATION 
>   ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java 9e638e832f1552c2e1d2b47953a3a2e5504d09c0 
>   ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/25940/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 19:08 min
> [INFO] Finished at: 2014-09-23T00:09:01-07:00
> [INFO] Final Memory: 29M/232M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>