Azkaban Alerter Plugin

Here's a simple step by step to create an alerter plugin on Azkaban, unfortunately the documentation doesn't cover that very well. I was able to put one together by going over the source code, hopefully it helps someone out there.

  • First of all you need to create an alerter class
package foo.bar;

import azkaban.alert.*;  
import azkaban.utils.*;  
import azkaban.executor.ExecutableFlow;  
import azkaban.sla.SlaOption;  
import azkaban.utils.Props;

public class MyAlerter implements Alerter {

    public MyAlerter(Props azkProps) {}

    public void alertOnSuccess(ExecutableFlow flow) throws Exception {
        // Do something like sending metrics to Datadog, Slack notifications, etc
    }

      public void alertOnError(ExecutableFlow flow, String ... extraReasons) throws Exception {
        // Do something like sending metrics to Datadog, Slack notifications, etc
      }

      public void alertOnFirstError(ExecutableFlow flow) throws Exception {
        // Do something like sending metrics to Datadog, Slack notifications, etc
      }

      public void alertOnSla(SlaOption slaOption, String slaMessage) throws Exception {
        // Do something like sending metrics to Datadog, Slack notifications, etc
      }
}
  • You need to to install it on (assuming your alerter is called myalerter) $AZKABAN_HOME/plugins/alerter/myalerter/lib/myalerter.jar

  • You also need to define a configuration for it $AZKABAN_HOME/plugins/alerter/myalerter/conf/plugin.properties

alerter.name=myalerter  
alerter.external.classpaths=  
alerter.class=foo.bar.MyAlerter  

Enjoy!