# Datadog

## Overview

Datadog gives you the ability to create monitors that actively check metrics, integration availability, network endpoints, and more.

Using the Fylamynt | Datadog integration you can see the list of available monitors and pick the monitor to trigger a workflow when it goes into the state of Alert.

## Use Cases

The integration between Fylamynt and Datadog lets you:

* Trigger a workflow in Fylamynt, when a specific DataDog monitor goes into the state of ALERT.
* Retrieve data from Datadog Monitors based on a search query.
* Returns the test result from all the synthetic tests.

## Configure Datadog in Fylamynt

* Navigate to **Settings** > **Integrations** > **Datadog**
* Configure a new integration instance

Details needed to set up **Datadog instance** in **Fylamynt**:

<table data-header-hidden><thead><tr><th>Parameter</th><th width="343.3333333333333">Description</th><th>Required</th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Description</strong></td><td><strong>Required</strong></td></tr><tr><td>Datadog API Key</td><td>API key for your Datadog instance</td><td>True</td></tr><tr><td>Datadog Application Key</td><td>Application key for your Datadog instance</td><td>True</td></tr><tr><td>External ID</td><td>Identifier that identifies the tenant, to be added into HTTP headers by Datadog</td><td>True</td></tr><tr><td>Webhook API Key Name</td><td>Fylamynt API Key Name</td><td>True</td></tr><tr><td>Datadog Webhook Name</td><td>Fylamynt webhook name to be used by Datadog service</td><td>True</td></tr><tr><td>Datadog Webhook URL</td><td>Fylamynt webhook URL to be used by Datadog service</td><td>True</td></tr></tbody></table>

Follow the steps listed below in your **Datadog Account** and get the desired parameters to enter in **Fylamynt**. To configure Datadog you will require access to **Organization settings** with **write permission** for **API Keys** and **Application Keys.**

* Login to your **Datadog Account**
* Navigate to **Organization settings**
  * Click on your username in the bottom left corner
  * Select Organization Settings
  * ![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2FzNzWwHrfWobOugPh5OUW%2Fimage.png?alt=media\&token=0aaa8edb-9eaf-4300-bce6-4c39934ec5ef)
* Select Access -> **API Keys**
* Click **+** **New Key**
  * Provide a name for the new API key
  * Click **Create Key**
  * ![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2FO6HZqiY1h1nxFZdxYUMR%2Fimage.png?alt=media\&token=1b3c17e1-f9dc-4cc5-8579-a01b404e7fa2)
  * Click **Copy Key**
    * Paste the new API Key into the **Datadog API Key** field on the Authorize Fylamynt card on the Datadog Integration settings page.
  * Close the window
* Select Access -> **Application Keys**
* Click **+** **New Key**
  * Provide a name for the new Application key
  * Click **Create Key**
  * ![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2FMkY9eOz4elr3LKv7S2Xe%2Fimage.png?alt=media\&token=2b9d451d-ece4-45e5-9018-3c1eddb15919)
  * Click **Copy Key**
    * Paste the new Application Key into the **Datadog Application Key** field on the Authorize Fylamynt card on the Datadog Integration settings page.
  * Close the window
* Navigate to **Integrations -> Integrations**
* ![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2F9ABuY2xd80fzUPjA0Udt%2Fimage.png?alt=media\&token=c6fc09b0-e0c4-4e4a-995f-b6b815804b1d)
* Go to the Team page
* Search and select for **webhooks**
* ![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2Fgg3WdXL5lmuaObhdipvG%2Fimage.png?alt=media\&token=a14ce820-18fb-4a0f-93a3-9281afbb5694)
* Click **+ New** button to create a new Webhook
* Complete “New Webhook” panel using the following details
  * Copy **Datadog Webhook Name** from the Authorize Fylamynt card as the **Name** of the New Webhook
  * Copy **Datadog Webhook URL** from the Authorize Fylamynt card as the **URL** of the New Webhook
  * Add **"alert\_id": "$ALERT\_ID"** in the JSON object for Payload
    * Optionally, add or remove any other fields
  * Check the **Custom Headers** box
    * Copy the JSON header information below and paste it into the Custom Header field
    * ```
      {
          "x-api-key": "<fylamynt-api-key>",
          "fylamynt-external-id": "<fylamynt-external-id>",
          "Content-Type": "application/json"
      }
      ```
    * Replace \<fylamynt-api-key>
      * From the Authorize Fylamynt card, choose one of the Webhook API Key Name from the dropdown, and the corresponding Webhook API Key Value should be shown
        * If no options are available for the Webhook API Key Name, first go to **Settings --> Resources -> API Keys** to create a New API Key
      * Copy the **Webhook API Key Value** and replace \<fylamynt-api-key> in the header.
    * Replace \<fylamynt-external-id>
      * From Authorize Fylamynt card, copy the **External ID** and replace \<fylamynt-external-id> in the header
* Click **Save** to complete Webhook creation

![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2F3INqLnxmpWVi4CmfeT4v%2Fimage.png?alt=media\&token=db2d4ee2-aa1a-4251-88b9-8ea75ce5879e)

* Click on the **Authorize** button to complete the integration between Fylamynt and Datadog

## Integration Actions

You can add these actions in the Fylamynt workflow builder, as part of your workflow.

1. [Datadog Alert Trigger](#datadog-alert-trigger)
2. [Datadog Get API Test Results](#datadog-get-api-test-results)
3. [Datadog Search Monitors](#datadog-search-monitors)

### Datadog Alert Trigger

The integration node triggers the automatic execution of a workflow from a selected **Datadog Monitor.**

When creating a workflow, you are presented with a wizard to select the trigger type to use.

* On the workflow page, select **New Workflow**
* Enter the name of the Workflow.
* Select the **Datadog** trigger type.
* Click **Create Workflow**
* ![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXYvxfYq9m2JdKqaCdk%2Fuploads%2FXpZXqlYLhqRNQnNPtNX3%2Fimage.png?alt=media\&token=5f5c80b6-7876-4a31-88dd-baeeb7767c01)

#### Configure the automatic execution of a workflow <a href="#fylamynt-task-management" id="fylamynt-task-management"></a>

To automatically run workflows with the Datadog Alert trigger, the incident type and assignment need to be configured. Follow the step-by-step instructions provided on the[ Incident Management - Automatic workflow execution](https://docs.fylamynt.com/getting-started-1/7.-incident-management-automatic-workflow-execution) page.

### Datadog Get API Test Results

Get the last 50 test results summaries for all Synthetics API tests.

**Input**

| **Parameter Name** | **Description**                                | **Required** |
| ------------------ | ---------------------------------------------- | ------------ |
| Start Timestamp    | Date-time from which to start querying results | False        |
| End Timestamp      | Date-time up to which to query results         | False        |

**Output**

| **Parameter Name** | **Type** | **Description**                       |
| ------------------ | -------- | ------------------------------------- |
| result             | Object   | A list of test result objects in JSON |

**Action Example**

![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXYvxfYq9m2JdKqaCdk%2F-Mkuy2Myzt35t7yBrqL5%2F-Mkuzni3cmxRTvq2DSyw%2Fimage.png?alt=media\&token=6325240b-edae-4a0c-aa25-e31b7ffb3307)

![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXYvxfYq9m2JdKqaCdk%2F-Mkuy2Myzt35t7yBrqL5%2F-MkuzqiV5J6wpc8-SNPo%2Fimage.png?alt=media\&token=6c01bbfe-1f41-4059-8208-67a5c1c3150d)

### Datadog Search Monitors

Perform a search query and return matching monitors

**Input**

| **Parameter Name** | **Description**                                                                                                                                                        | **Required** |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| Query              | The query to be executed. Query documentation: <https://docs.datadoghq.com/monitors/manage_monitor/#find-the-monitors>                                                 | True         |
| Page Index         | Page to start paginating from                                                                                                                                          | False        |
| Monitors Per Page  | Number of monitors to return per page                                                                                                                                  | False        |
| Sort Order         | String for sort order, composed of field and sort order separate by a comma, e.g. name,asc. Supported sort directions: asc, desc. Supported fields: name, status, tags | False        |

**Output**

| **Parameter Name** | **Type** | **Description**            |
| ------------------ | -------- | -------------------------- |
| result             | Object   | A list of monitors in JSON |

**Action Example**

![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXYvxfYq9m2JdKqaCdk%2F-Mkuy2Myzt35t7yBrqL5%2F-MkuzytEs78U3Yf0ihSl%2Fimage.png?alt=media\&token=6b4d7f20-f956-40f4-999a-075b2b302ed8)

![](https://2168485084-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXYvxfYq9m2JdKqaCdk%2F-Mkuy2Myzt35t7yBrqL5%2F-Mkv-19fq0M-_RRCsEk9%2Fimage.png?alt=media\&token=64757372-0a64-4bca-be5c-157a52df3139)
