Datadog


Learn how to use Datadog to automatically keep status of your Golive environments up to date


Integrate Golive with Datadog Synthetic Monitoring


Datadog Synthetic Monitoring allows to easily check availability of your applications.
Learn more: https://docs.datadoghq.com/synthetics/

In this section, you will learn how to configure Datadog in order to automatically update the status of Golive environments when an alert or a recovery event is raised by Datadog


Ensure to have installed version 9.6.4 (or higher) of Golive

:question_mark:

If you do not have an existing Datadog account, you can easily create a free account to perform this tutorial: https://app.datadoghq.com/signup

 


Connect Datadog with Golive API

Datadog will be the master system in charge to notify Golive when an environment is up or down. In order to do that, we must setup a connection between Datadog and the Golive Rest API. This connection will be used to update status of the Golive environments that are monitored by Datadog.

STEP 1 Open the Webhooks configuration page

Go to “Integrations” section and search for the “Webhooks” integration:

Screen Shot 2023-01-10 at 18.40.37.png

Select the “Webhooks” integration and click on “Configure” button to configure a connection with Golive:

Screen Shot 2023-01-10 at 18.44.02.png

STEP 2 Create a variable to store the Golive credentials

Create a new variable to store the credentials that you will need to connect to Golive REST API:

  • Click on “New Variable” button:

Screen Shot 2023-01-10 at 19.08.31.png


  • name the new variable “GOLIVE_BEARER_TOKEN”

  • prepare a new Bearer token that will be stored as “VALUE”

    • generate a new Golive API token and paste it in “VALUE” field

    • Type “Bearer “ in front of your token in “VALUE” field

    • your Bearer token must respect this structure:

      Bearer your_pasted_api_golive_token
      
  • check the “hide from view” option:

Screen Shot 2023-01-10 at 18.47.45.png
  • Click on “Save”

STEP 3 Configure a webhook to mark Golive environments as “Down”

Create a new Datadog webhooks to be used when a Golive environment status must be set to “Down”

  • Click on “New” to create a new webhook:

Screen Shot 2023-01-10 at 19.12.26.png
  • Choose an explicit “Name”, for example: “golive-status-change-down”

  • use the following endpoint as “URL”:

https://golive.apwide.net/api/status-changes
  • use the following json as “Payload”:

JSON
{
  "scope": {
    "criteria": [
      {
        "name": "environmentId",
        "values": [
          "$TAGS[golive_env_id]"
        ]
      }
    ]
  },
  "status": {
    "name": "Down"
  }
}
  • activate the “Custom Headers” checkbox

  • use the following json as “Custom Headers”:

JSON
{
"Authorization": "$GOLIVE_BEARER_TOKEN"
}
  • ensure that “Encode as form” is NOT checked

  • check that your configuration looks like that:

Screen Shot 2023-01-13 at 14.39.44.png

This will work if the default environment status called “Down” exists.
If you have renamed it, change “Down” to your custom environment status name in the JSON payload.

  • click on “Save”

STEP 4 Configure a webhook to mark Golive environments as “Up”

Create a new Datadog webhooks to be used when a Golive environment status must be set to “Up”

→ execute the same action as described in STEP 3 but replacing everywhere “Down” by “Up”¨

You should end with such a webhook configuration:

Screen Shot 2023-01-13 at 13.45.31.png

This will work if the default environment status called “Up” exists.
If you have renamed it, change “Up” to your custom environment status name in the JSON payload.

STEP 5 Ensure that the 2 Golive webhooks are properly created

The 2 webhooks created in STEP 3 and in STEP 4 should now appear in your “Webhooks” list:

Screen Shot 2023-01-13 at 13.47.37.png

Memorize the name of these 2 webhooks. They will be used in following steps.


Enable monitoring of an Environment

STEP 1 Create a new Golive Environment and get its ID

Connect to Golive and create a new Golive environment that you will use to test this integration.

:info:

Learn how to create a new environment here: Clone and Delete Environments

Memorize the id of the environment that you want to use to test this integration.

In current example, the id of this environment is 28.

STEP 2 Create a new Synthetic Test

Connect to Datadog, click on “UX Monitoring” and select “Synthetic Tests” in order to create a new url tester:

Screen Shot 2023-01-13 at 13.53.36.png


STEP 3 Create a new Synthetic Test

Click on “New Test” buton top right:

Screen Shot 2023-01-13 at 13.56.58.png

Select “API Test”:

Screen Shot 2023-01-13 at 13.58.39.png

Set the url that you want to use to check availability of your environment and click on “Create new Env Tag” button:

Screen Shot 2023-01-13 at 14.01.25.png

You must add a tag called “golive_env_id” containing the id of the Golive environment that is monitored
Ex: golive_env_id:28 (without space, where 28 should be replaced by your own Golive environment id):

Screen Shot 2023-01-13 at 14.09.47.png

Click on “Test URL” button

STEP 4 Select locations

Click on “All Locations” to select all locations:

Screen Shot 2023-01-13 at 14.12.33.png

If you want to test an environment that is not directly reachable from Internet, you should configure a “Private Location”: https://docs.datadoghq.com/getting_started/synthetics/private_location/

STEP 5 Configure the alert monitor

Let all default setup in the next steps until you enter the “Configure the monitor for this test” step:

Screen Shot 2023-01-13 at 14.17.25.png

Copy the following code snippet:

{{#is_alert}} @webhook-golive-status-change-down {{/is_alert}} 
{{^is_alert}} @webhook-status-changes-up {{/is_alert}} 

Paste the code snippet into the Template editor and check that you get such a configuration:

Screen Shot 2023-01-13 at 14.20.21.png

Scroll down and click on “Create” button in order to save your new test:

Screen Shot 2023-01-13 at 14.18.07.png


👍

You have configured your first monitoring of a Golive environment!

You can repeat these steps to create a synthetic test for each of your Golive Environments.


Test your Synthetic Test

Select the Synthetic test you want to test and click on “Edit”:

Screen Shot 2023-01-13 at 14.28.17.png


Replace the right URL by a fake one:

Screen Shot 2023-01-13 at 14.30.20.png

Click on “Save” button:

Screen Shot 2023-01-13 at 14.31.14.png


Click on “Run Test Now” button:

Screen Shot 2023-01-13 at 14.31.40.png

Wait for 1-2 minutes, the test should now fail:

Screen Shot 2023-01-13 at 14.33.12.png


Connect to Golive and check that the status of your environment is now “Down” in Golive.

Put back the right URL:

Screen Shot 2023-01-13 at 14.35.07.png

Click on “Save” button:

Screen Shot 2023-01-13 at 14.31.14.png

After a while, check that the status of your environments is “Up” again in Golive.