Cookie consent

By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Use Datadog to automate the creation of a runbook

Last updated: October 7th, 2024

Problem Statement

Cutover runbooks can be created manually using the user interface, however there are many cases where you may want to automatically create a runbook as a result of monitoring incidents.

Solution

Datadog’s monitor functionality can be configured in various ways including actively checking when an application has failed. A monitor can be configured together with a webhook to leverage the Cutover API to create a runbook from a template. 

Key Benefits

  • Move through Cutover at speed
  • Save time and effort
  • Less room for error
  • Ability to respond to incidents in real time

Configuring your Datadog Monitor and Webhook

This section provides guidance on how to create your Datadog monitor and your Datadog webhook. When the Datadog monitor conditions are met, the webhook will trigger copying a runbook from a template.

Prerequisites

1. You will need to ensure you have the ability to create or edit monitors in Datadog.

2. You will need to ensure you have the ability to create Datadog webhooks. 

3. You will need Workspace Runbook Creator or Folder Runbook Creator in the appropriate workspace to create a new runbook. 

Note: The steps documented may differ depending on your Datadog set up. Use these as an example to understand the changes and match them to your current configuration where necessary.

Steps for Creating the Datadog Webhook and Monitor

In order to create the Datadog webhook and monitor, you will need to follow the steps below:

1. Create your Datadog webhook to trigger and copy a runbook from a template.

2. Configure your Datadog monitor.

3. Test your Datadog webhook.

Create your Datadog webhook to trigger and copy a runbook from a template

1. Once the prerequisites are met, click on Integrations > In the search bar type in webhook > Click webhooks as shown below:

2. Click on Configure you will be presented with the following configuration screen:

3. The following fields will need to be configured in your New webhook:

  • Name:  Enter webhook name
  • URL: Enter your webhook URL. The Runbook endpoint will be  https://api.<yourcutoverinstance>.cutover.com(or.net)/core/runbooks
  • Auth Method: You can leave this blank, the bearer token will be added to the custom header as detailed in the next section.

For the payload we will be using the following:

{
  "data": {
    "type": "runbook",
    "attributes": {
      "name": "DNS-Recovery"
    }
  },
  "meta": {
    "copy": {
      "source_runbook_id": "Enter Runbook ID  you wish to copy"",
      "tasks": true,
      "teams": true,
      "users": true
    },
    "shift_fixed_times": true
  }
}
  
Copy to clipboard

4. Once the payload is configured you will need to check the box to use Custom Headers and then in the box below paste the following to pass your appropriate Cutover bearer token: {"Authorization":"Bearer yourtokenhere"}

Configure your Datadog monitor

Once the prerequisites are met, you can create your new Datadog monitor by following these steps:

1. Navigate to Monitors > click New Monitor. You will see a page as shown in the screenshot below:

You can define monitors for a variety of different scenarios and conditions once you have defined this please navigate to step 4 in the process titled Configure notifications & automations. The webhook can be included here by using the @ symbol you can then choose the webhook that would like to be triggered. 

Test your Datadog webhook

1. Now in order to test the webhook, you can go back to the monitor that you created and click Test Notifications, which will trigger everything in the notifications and automations section.

2. Now if we go back to Cutover, we can check and ensure that the runbook has been created: 

Going forward when the monitor conditions have been met, this will trigger the creation of a new runbook. 


Available endpoints