You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Overview

This document will describe how to enable a custom script-based alert dispatcher which is capable of responding to Ambari alerts. The dispatcher will invoke a script with the parameters of the alert as command line arguments.

Configuration Changes

The dispatcher must know the location of the script that is being executed. This is configured through ambari.properties by setting either:

  • notification.dispatch.alert.script
  • a custom property key that points to the script, such as foo.bar.alert.dispatch.script

Some examples of this are:

notification.dispatch.alert.script=/contrib/ambari-alerts/scripts/default_logger.py
    com.mycompany.dispatch.syslog.script=/contrib/ambari-alerts/scripts/legacy_sys_logger.py
    com.mycompany.dispatch.shell.script=/contrib/ambari-alerts/scripts/shell_logger.sh

API Calls

Alert Target Creation

POST api/v1/alert_targets
    
    {
      "AlertTarget": {
        "name": "syslogger",
        "description": "Syslog Target",
        "notification_type": "ALERT_SCRIPT",
        "global": true
      }
    }

The above call will create a global alert target that will dispatch all alerts across all alert groups. Without specifying ambari.dispatch-property.script as a property of the alert target, Ambari will look for the default configuration key of notification.dispatch.alert.script in ambari.properties.

Custom Script For Target

POST api/v1/alert_targets
    
    {
      "AlertTarget": {
        "name": "syslogger",
        "description": "Syslog Target",
        "notification_type": "ALERT_SCRIPT",
        "global": true,
        "properties": {
          "ambari.dispatch-property.script": "com.mycompany.dispatch.syslog.script"
        }
      }
    }

The above call also creates a global alert target. However, a specific script key is being specified. The result is that ambari.properties should contain something similar to:

com.mycompany.dispatch.syslog.script=/contrib/ambari-alerts/scripts/legacy_sys_logger.py
  • No labels