Skip to main content

Home

Use case - AutoActions and Pagerduty

This topic explains how to configure Pagerduty and your Unravel server in order to receive AutoActionnotifications via Pagerduty.

The AutoAction's template provides the ability to send alerts via email to one or more recipients and/or create a HTTP endpoint allowing integration with a third party tool, e.g., Slack. These two options are specified when creating/editing an AutoAction. Once entered nothing further needs to be done for notifications to be sent.

Unravel has developed a third option allowing you to use Pagerduty to send notifications to one or more users through Unravel's AutoActions API.

Currently, this action is initiated outside of Unravel's server. For the integration you need to complete two (2) setups:

  • Set up a service at Pagerduty and specify who should be notified and how (email, etc.), and

  • Run a python script on your local machine, specifying the Unravel server and Pagerduty information.

    Note

    The python script must be running with the correct parameters in order for pagerduty to receive and forward notifications.

Set up a Pagerduty service
  1. Login to your Pagerduty Account. Select the Configuration pulldown menu and chose Services. You can register at Pager Duty.

    PagerDuty-Services.png
  2. Select Add New Service.

    PagerDuty-AddService.png
  3. Name the new service. Select Use our API directly and chose Events API v2 from the pull down menu.

    PagerDuty-AddingNewService.png
  4. Use the defaults for the remaining options and click Add Service.

    PagerDuty-AddServiceButton.png
  5. Copy the Integration Key from the Service Details Integrations tab as you need it for Unravel's AutoActions API.

    PagerDuty-Key.png
Run Unravel's API python script on your local computer
  1. Download the Unravel demo program to the directory of your choice on your local machine.

    # git clone https://github.com/Unravel-Andy/unravel-api-demo-v1
  2. cd to unravel-api-demo-v1.

    # cd unravel-api-demo-v1
    # ls
    README.md  
  3. Run the python script to bring up the Unravel API Demo window

  4. Enter your Unravel Server's address in Unravel AutoActions API Address text box.

    Note

    The AutoActions API address has the form of http[s]://UNRAVEL_HOST_IP/api/v1/autocactions. Substitute a fully qualified DNS or IP address for UNRAVEL_HOST_IP. In the example below the server is https://playground.unraveldata.com.

    Enter the pagerduty integration key in the Pagerduty API key text box. Be sure to enter integration key correctly ensure a connection with Pagerduty. An incorrect key, or spaces around the key will prevent connecting with Pagerduty.

    filledIn-unravelAPI-boxed.png
  5. Click Start to populate the window with the defined AutoActions and their status. These are sorted on status first and then alphabetically in ascending order.

    Started-unravelAP.png

    To scroll within list, click within the AutoAction Name list and scroll.

    scrolldown-unravelAPI.png
  6. Open your browser and login to the Unravel Server you entered above.

    Navigate to the AutoActions page (Manage | AutoActions). See Creating AutoActions if you don't know how to navigate to AutoActions. The Unravel UI shows the same list of active and inactive AutoActions listed in Unravel API window.

    AutoAutosServer-Sorted.png
  7. Both the Unravel API window and the Unravel UI shows the exact same list of AutoActions and their status. Toggle one of the AutoActions to see the effect.

    In our example there were 2 active AutoActions, Kill job hogging the cluster and Rogue App AA #1. We deactivated Kill job hogging the cluster.

  8. In the UI and Unravel API window, you will see the change.

    Kill job hogging the cluster was moved to the inactive status/list in both the Unravel UI and Unravel AutoActions API window.

    Updated Unravel UI

    UI-1Active.png

    Updated Unravel API - In both screenshots below, Kill job hogging the cluster is shown inactive. The one on the left shows a successful connection to pagerduty, so notification was made. The shot on the right shows a failed connection with no notification made. The key was invalid because a space was added to the end of the string.

    SuccessFailureAPI.png
  9. Pagerduty, upon receiving the status change information, will transmit it to the parties specified in the service detail.

    Sample sms message

    Pagerduty-smsMessages.png

    Sample email

    pagerDutyEmail.png

Note

The python script must be running with the correct parameters in order for pagerduty to receive and forward notifications.