Skip to main content
Datadog

Integrate Datadog with Torq to automate workflows via event triggers, log searches, and event management within workflows.

Updated over 5 months ago

The Datadog integration enables you to trigger workflows with Datadog events, search logs, and get/post events to Datadog from Torq workflows.

Use Datadog to Trigger Torq workflows

  • Create a Datadog trigger integration

  • Define monitors to trigger workflows in Torq

Create a Datadog Trigger Integration in Torq

  1. Go to Build > Integrations > Triggers > Datadog and click Add.

  2. Enter a meaningful name for the integration and click Add.

  3. Copy the Webhook URL that is generated. You'll need this URL when you configure a Webhook integration in your Datadog tenant.

In Datadog Define the Monitors to Trigger Torq Workflows

For more information, see the troubleshooting section.

  1. In Your Datadog Account: Go to Integrations > Integrations, click the Webhooks card, and click New.

    Screenshot of going to the webhook card in Datadog.
  2. Enter a meaningful name for the Webhook integration and paste the Webhook URL that you generated in Torq. The integration name is how you'll the identifier (remember to use it later in specific Datadog monitors to trigger Torq) and the Webhook URL from the previous step.

    Screenshot of creating a webhook in Datadog.
  3. Pick monitors that will trigger Torq workflows. In the Alert Your Team field add a reference to the newly created Webhook integration. For more information, see the Datadog documentation.

By default, payload values are wrapped in quotation marks. This will cause them to be read as a string in Torq and likely cause an issue. If your variable contains a JSON, remove the quotation marks, and it will be processed properly.

Torq recommends adding additional alert information to the payload. You can use portions of the below JSON configuration

{ 
"body": "$EVENT_MSG",
"title": "$EVENT_TITLE",
"date": "$DATE",
"id": "$ID",
"metadata": {
"AGGREG_KEY": "$AGGREG_KEY",
"ALERT_CYCLE_KEY": "$ALERT_CYCLE_KEY",
"ALERT_ID": "$ALERT_ID",
"ALERT_METRIC": "$ALERT_METRIC",
"ALERT_QUERY": "$ALERT_QUERY",
"ALERT_SCOPE": "$ALERT_SCOPE",
"ALERT_STATUS": "$ALERT_STATUS",
"ALERT_TITLE": "$ALERT_TITLE",
"ALERT_TRANSITION": "$ALERT_TRANSITION",
"ALERT_TYPE": "$ALERT_TYPE",
"EMAIL": "$EMAIL",
"EVENT_MSG": "$EVENT_MSG",
"EVENT_TITLE": "$EVENT_TITLE",
"EVENT_TYPE": "$EVENT_TYPE",
"HOSTNAME": "$HOSTNAME",
"ID": "$ID",
"LAST_UPDATED": "$LAST_UPDATED",
"LINK": "$LINK",
"METRIC_NAMESPACE": "$METRIC_NAMESPACE",
"ORG_ID": "$ORG_ID",
"ORG_NAME": "$ORG_NAME",
"PRIORITY": "$PRIORITY",
"SNAPSHOT": "$SNAPSHOT",
"TAGS": "$TAGS",
"TEXT_ONLY_MSG": "$TEXT_ONLY_MSG",
"USER": "$USER",
"USERNAME": "$USERNAME",
"LOGS_SAMPLE": "$LOGS_SAMPLE" }
}

Troubleshooting

Some common issues you might experience with Datadog trigger integration.

JSON Parsing as String

In the example below, the variable's value is a JSON object. To ensure the event is parsed correctly in Torq, you need to remove the double quotes. For example:

{ 
"body": "$EVENT_MSG",
"title": "$EVENT_TITLE",
"date": "$DATE",
"id": "$ID",
"metadata": {
"AGGREG_KEY": "$AGGREG_KEY",
"ALERT_CYCLE_KEY": "$ALERT_CYCLE_KEY",
"ALERT_ID": "$ALERT_ID",
"ALERT_METRIC": "$ALERT_METRIC",
}
}

The result will look like this:

{ 
"body": $EVENT_MSG,
"title": $EVENT_TITLE,
"date": $DATE,
"id": $ID,
"metadata": {
"AGGREG_KEY": $AGGREG_KEY,
"ALERT_CYCLE_KEY": $ALERT_CYCLE_KEY,
"ALERT_ID": $ALERT_ID,
"ALERT_METRIC": $ALERT_METRIC,
}
}

Use Datadog Steps in Torq workflows

You need to create a Datadog API key and an application key, which you'll use as input parameters for Datadog steps in Torq. Some Datadog steps in Torq require API and application keys, and some require Datadog integration.

Create an API Key in Datadog

After you create the API key, make sure you copy and save it. You won't be able to access it later. For more information about API keys, see the Datadog documentation.

  1. Hover over your user name and select Organization Settings.

  2. From the left panel, click API Keys.

  3. Click + New Key.

    Screenshot showing how to create an API key in Datadog.
  4. Enter a meaningful name for the API key, such as, Torq, and click Create Key.

  5. Copy the Key and save it. You will need this key when creating a Datadog integration in Torq.

Create an Application Key in Datadog

After you create the application key, make sure you copy and save it. You won't be able to access it later. For more information about application keys, see the Datadog documentation.

  1. Hover over your user name and select Organization Settings.

  2. From the left panel, click Application Keys.

  3. Click + New Key.

    Screenshot showing how to create an app key in Datadog.
  4. Enter a meaningful name for the application key, such as Torq, and click Create Key.

  5. Copy the Key and save it. You will need this key when creating a Datadog integration in Torq.

Create a Datadog Steps Integration in Torq

  1. Go to Build > Integrations > Steps > Datadog and click Add.

  2. Enter a meaningful name for the integration.

  3. Enter the Datadog API key and app key, and click Add.

Collected Data

Data that the Torq integration collects.

Metrics

The Torq integration does not provide any metrics.

Events

The Torq integration allows you to send events to your Datadog event stream from a Torq workflow using the step Datadog Post Event step. You can use the step with your playbooks to notify Datadog about successful mitigations and execution failures and send enriched alert data back to Datadog.

Service Checks

The Torq integration does not include any service checks

Did this answer your question?