> ## Documentation Index
> Fetch the complete documentation index at: https://docs.augmentcode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate Datadog

## Introduction

In this page we’ll learn how to configure 2 things:

* Get Datadog to push events to Augment Cosmos via webhooks

```mermaid theme={null}
sequenceDiagram
	autonumber
	participant J as Datadog
	participant AC as Augment Cosmos

	J->>AC: Webhook: Issue Created (Ticket JSON)
```

* Get Augment Cosmos to interact with Datadog via the Datadog MCP server

```mermaid theme={null}
sequenceDiagram
	autonumber
	participant J as Datadog
	participant AC as Augment Cosmos

	AC->>J: Read logs via Datadog MCP server
	J-->>AC: 200 OK (Sync Complete)
```

## Prerequisites

* Cosmos side: any user who can self-create webhooks and MCP servers
* Datadog side: any user with **Datadog Admin Role** or at least those permissions:
  * To create a service account: **Service Account Write** and \*\*User Manage Access \*\*permissions
  * To create an Organization API key: **API Keys Write** and **User Application Keys Write** permissions
  * To configure a webhook: **Integrations Manage** permission

## Step 1 - Configure Datadog to notify a Cosmos Webhook

Let’s create a new webhook in Cosmos (so Cosmos can listen to Datadog events).
Configuration steps:

* Go to Cosmos ([https://cosmos.augmentcode.com](https://cosmos.augmentcode.com)) > Settings > Organization settings > Configuration > Capabilities > Webhooks ([https://cosmos.augmentcode.com/webhooks](https://cosmos.augmentcode.com/webhooks)) > Create Webhook
  * Description “Datadog”
  * Type: Bearer Token
  * Keep shared toggled on
    <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-01.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=f1eb25f0f135f0015fe03e11d174eee8" alt="" width="1394" height="724" data-path="images/cosmos-integrations/datadog/datadog-01.png" />
* That gives us a url to POST with a given Bearer token to pass as HTTP header. Curl request would look like:

```shell theme={null}
curl -X POST https://XXX.api.augmentcode.com/webhooks/XXX \
  -H "Authorization: Bearer XXX" \
  -H "Content-Type: application/json" \
  -d '{"event": "test", "data": "your payload here"}'
```

\*\*Create a new webhook config in Datadog \*\*(so Datadog can POST to a given url when certain Datadog events occur)

* In Datadog
  * Go to Integrations > search for Webhooks (ex: [https://us5.datadoghq.com/integrations?search=webhook\&integrationId=webhooks](https://us5.datadoghq.com/integrations?search=webhook\&integrationId=webhooks)) > Configure tab
    <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-02.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=28db5ca6f60438e8313437cf34e7d11e" alt="" width="788" height="716" data-path="images/cosmos-integrations/datadog/datadog-02.png" />
    <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-03.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=01af8f0225091ad420fb64cb8f65baa4" alt="" width="464" height="448" data-path="images/cosmos-integrations/datadog/datadog-03.png" />
  * Variables tab > New Variable and create variable **\$AUTH\_BEARER\_TOKEN** with value **Bearer \<YOUR\_COSMOS\_WEBHOOK\_BEARER\_TOKEN>**
    <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-04.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=a0860a1d0e845b7f7dbed29949fad3f8" alt="" width="2010" height="1196" data-path="images/cosmos-integrations/datadog/datadog-04.png" />
  * Webhooks tab > New > Add > Enter the Cosmos webhook url, keep auth method empty, select Custom header and add

```plain text theme={null}
{
  "Authorization": "$AUTH_BEARER_TOKEN"
}
```

<img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-05.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=e50a065cb21c741e7cda900d3f1fe429" alt="" width="1954" height="1548" data-path="images/cosmos-integrations/datadog/datadog-05.png" />

* Click on Save
  Now let’s run a test with a Datadog monitor:
* Datadog home > Monitoring > New monitor
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-06.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=8dcd096711a8deaff136d80a04ee2462" alt="" width="944" height="390" data-path="images/cosmos-integrations/datadog/datadog-06.png" />
* Enter those parameters
  * detection method: **Threshold Alert**
  * Set alert conditions > Alert threshold > enter value “**1**”
  * Configure notifications & automations
    * Monitor name: Test Cosmos webhook config
    * Edit section: type in @ and select your webhook name in the drop down list
      <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-07.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=6159fa2eea2cced6d4247c3b1d9c1932" alt="" width="2132" height="3086" data-path="images/cosmos-integrations/datadog/datadog-07.png" />
* Now click on Test Notifications > Run Test
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-08.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=b8798dc5b401e1ed6b1f7ab669ac87cb" alt="" width="1042" height="1120" data-path="images/cosmos-integrations/datadog/datadog-08.png" />
  Now let’s check that Cosmos received that event.
* Go to Cosmos > Settings > Organization Settings > Automations > Event Log [https://cosmos.augmentcode.com/automations/events](https://cosmos.augmentcode.com/automations/events). You should see a new Custom.webhook entry
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-09.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=3d9021e38b816fe6e9d261dfc81a66fd" alt="" width="1186" height="326" data-path="images/cosmos-integrations/datadog/datadog-09.png" />
* Click on that event entry and you’ll see the test payload from Datadog
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-10.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=899b9730a0b3edfaf08262961723d3ee" alt="" width="976" height="712" data-path="images/cosmos-integrations/datadog/datadog-10.png" />
  At this point Datadog can invoke Cosmos ✅

## Step 2: Integrate with Datadog via a Service Account

For Cosmos to interact with Datadog via a Datadog service account we’ll leverage the Datadog remote MCP server and authenticate it with said service account as we’d want Cosmos to run headless automations.
We’ll need 3 parameters:

* A Datadog tenant region
* A Datadog organization API key
* A Datadog service account application key
  You should be able to tell what is your Datadog region from the dashboard url. If it’s [https://us5.datadoghq.com/monitors/create/metric](https://us5.datadoghq.com/monitors/create/metric) then your region is us5. We’ll use that value for the rest of this tutorial, just remember to replace it with yours.
  Now let’s create an organization API key:
* Click on your username bottom left > Organization Settings > API Keys
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-11.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=521ceab56e5b99139890088007c77aff" alt="" width="1640" height="656" data-path="images/cosmos-integrations/datadog/datadog-11.png" />
* Click on New Key > Enter name: Cosmos > Create Key
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-12.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=b6eb23188cd410cebfd2dbfd5fa5d1f6" alt="" width="1034" height="612" data-path="images/cosmos-integrations/datadog/datadog-12.png" />
  Copy your API Key, we’ll need it later on.
  Now let’s create a service account application key:
* Click on your username bottom left > Organization Settings > Service Accounts
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-13.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=c815f1ef5094d6070ea6d172f7db5934" alt="" width="1650" height="654" data-path="images/cosmos-integrations/datadog/datadog-13.png" />
* Click on New Service Account > Enter a name, email, assign role \*\*Datadog Read Only Role \*\*> Create Service acccount
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-14.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=040d6cf4ec2c07bba3527372821c2786" alt="" width="1040" height="666" data-path="images/cosmos-integrations/datadog/datadog-14.png" />
* In the section Application Keys > Click on New Key > Name: Cosmos > Click on Create Key
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-15.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=bfbe0ee0d53aa2f8390e32118c502e81" alt="" width="1036" height="804" data-path="images/cosmos-integrations/datadog/datadog-15.png" />
* Stay on that view. In front of Scopes click on Edit > make sure that all those scopes are selected:
  * **mcp\_read**
  * **monitors\_read**
  * **dashboards\_read**
  * **metrics\_read**
  * **events\_read**
  * **logs\_read\_data**
  * **incident\_read**
* Then click on Save. You should see this:
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-16.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=1867985ea15e71671e3f3ccdb08822d9" alt="" width="1038" height="802" data-path="images/cosmos-integrations/datadog/datadog-16.png" />
* Click on Copy to copy the application key (we’ll need it shortly), then click on Finish. Your Service account view should look like this:
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-17.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=b7bba632bee14b6e20927f784786dada" alt="" width="1386" height="1344" data-path="images/cosmos-integrations/datadog/datadog-17.png" />
  Now, let’s verify that your Datadog parameters are valid. Open a terminal on your laptop, edit and run this command (make sure to also edit your instance region in the url):

```bash theme={null}
curl -s -w "\n%{http_code}" \
  -X POST \
  -H "DD-API-KEY: <YOUR_DATADOG_API_KEY>" \
  -H "DD-APPLICATION-KEY: <YOUR_DATADOG_APPLICATION_KEY>" \
  -H "Content-Type: application/json" \
  "https://mcp.us5.datadoghq.com/api/unstable/mcp-server/mcp" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
```

If everything is properly configured, you’ll get a 200 response. If you don’t, stop and review again the instructions above.
Now you’re ready to configure the Datadog MCP server in Cosmos.

* Go to Cosmos > Settings > Organization Settings > Capabilities > MCP Registry ([https://cosmos.augmentcode.com/mcp](https://cosmos.augmentcode.com/mcp)) > Add Server
  * Name: **Datadog**
  * Server URL: **[https://mcp.us5.datadoghq.com/api/unstable/mcp-server/mcp](https://mcp.us5.datadoghq.com/api/unstable/mcp-server/mcp)** (make sure to edit your instance region)
  * Authentication Type: Header > Add those 2 headers
    * **DD-API-KEY**: \<YOUR\_DATADOG\_API\_KEY>
    * **DD-APPLICATION-KEY**: \<YOUR\_DATADOG\_APPLICATION\_KEY>
  * Keep enabled products CLI and Cosmos Agent toggled on
  * Visibility > Shared toggled on
  * Click on Save Changes
    <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-18.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=592d239a57ecab5cdf66972d7b76fd04" alt="" width="740" height="1062" data-path="images/cosmos-integrations/datadog/datadog-18.png" />
    Now let’s test end2end connectivity with a new Cosmos session using that MCP server.
* Go to Cosmos > New session [https://cosmos.augmentcode.com/home](https://cosmos.augmentcode.com/home)
* Make sure the Datadog MCP server is selected
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-19.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=7235011614a2c84c99368b01f3473022" alt="" width="1176" height="674" data-path="images/cosmos-integrations/datadog/datadog-19.png" />
* Submit this prompt “What tools can I access with the connected datadog mcp? what user/service account it is using?”. In your session’s right drawer you should see the Datadog MCP tools:
  <img src="https://mintcdn.com/augment-mtje7p526w/yIfhAqnm6fBz5VQx/images/cosmos-integrations/datadog/datadog-20.png?fit=max&auto=format&n=yIfhAqnm6fBz5VQx&q=85&s=42760a735050692c96a0d2524cb42fa9" alt="" width="2066" height="1412" data-path="images/cosmos-integrations/datadog/datadog-20.png" />
  Congrats, you can now create Cosmos expert agents that integrate with Datadog! ✅
