# Import metrics from Datadog

### Create a Datadog metric data source

#### In Datadog

1. Go to **Organization Settings** --> **API Keys** and click **New Key.**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FahgQWRoUfj6T2YEEBJhf%2FScreenshot%202022-11-24%20at%2021.18.37.png?alt=media&#x26;token=c51b761b-eed8-4396-8285-04bbedecfb7a" alt=""><figcaption></figcaption></figure>
2. Give the Key a name (e.g., ilert metrics import) and click **Copy Key,** and paste it somewhere. You will need this key later in ilert.
3. Go to **Organization Settings** --> **Application Keys** and click **New Key.**
4. Give the Key a name and copy and paste somewhere. You will need the application key later in ilert.

#### In ilert

1. Go to **Status pages** (or **Incident comms**) --> **Metric data sources,** and click on **Create metric data source.**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FCWmR0t6fI0MrNjyr8M3V%2FScreenshot%202022-11-24%20at%2021.39.53.png?alt=media&#x26;token=2cdaf6ea-7435-4851-bf73-9128a65c26b4" alt=""><figcaption></figcaption></figure>
2. Give the metrics data source a name (e.g., Datadog).
3. Select **Datadog** in **Type** dropdown list.
4. Select your Datadog region. You can identify your region by matching your Datadog website URL to the URL from the list.
5. Enter the API and Application keys from above and click **Create metric data source**.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F7mlMaJALjZ99ASPBoRCz%2FScreenshot%202022-11-24%20at%2021.45.17.png?alt=media&#x26;token=79d01e75-413c-41ec-a467-6905245ff5ba" alt=""><figcaption></figcaption></figure>

### Create a metric

#### In Datadog

1. Find the metric you want to import to ilert, e.g., by opening a dashboard.&#x20;

2. Click on **Edit this widget.**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FFDyh5eFQy9osl0DwJQY6%2FScreenshot%202022-11-24%20at%2023.44.29.png?alt=media&#x26;token=bd3dee1d-45f0-4323-aaf6-100d98f53e2c" alt=""><figcaption></figcaption></figure>

3. In the **Edit** view, choose the graph you want to import and click on the `</>` icon to display the metric query.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FAQ7ZmvoGXGUgkialqqm7%2FScreenshot%202022-11-24%20at%2023.48.31.png?alt=media&#x26;token=2a23f4d7-bdce-4e16-8290-8a11d56fcbcd" alt=""><figcaption></figcaption></figure>

4. Copy the metric query. You will need the query below in ilert.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FEZ2jwYadIgdxf8WDhojw%2FScreenshot%202022-11-24%20at%2023.53.00.png?alt=media&#x26;token=e8e20fa2-06b2-4eb8-964f-e9ce21a06f8f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Note that metrics in ilert are not dimensional. Therefore, only Datadog metrics without grouping can be imported. See the Datadog documentation on [Anatomy of a metric query](https://docs.datadoghq.com/metrics/#anatomy-of-a-metric-query).

<img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FNF3MI1GRzafwaRUMqv9v%2FScreenshot%202022-11-24%20at%2023.59.35.png?alt=media&#x26;token=096d1363-e005-4ad8-9744-4364f9938c2f" alt="" data-size="original">

For example, the following query is not supported:

&#x20; `max:system.disk.in_use{host:app_prod} by {device}`

While this query is supported:

&#x20; `max:system.disk.in_use{host:app_prod}`
{% endhint %}

#### In ilert

1. Go to **Status pages** (or **Incident comms**) --> **Metrics,** and click **Create metric.**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F9jx8hMI3wSsZGunxLbK1%2FScreenshot%202022-11-25%20at%2000.10.24.png?alt=media&#x26;token=c828c554-ce37-4ce2-912a-7bad44e22323" alt=""><figcaption></figcaption></figure>

2. Select the Datadog metrics data source that you have created above and click **Next.**

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FFfC246lXbLrjYebcbR2T%2FScreenshot%202022-11-25%20at%2000.11.33.png?alt=media&#x26;token=67b41069-a4e0-4cb1-b778-b5c944be33ef" alt=""><figcaption></figcaption></figure>

3. On the next screen, enter a metric name and a display unit. Paste the metric query from step 4 above. Click **Save** to preview your metric data.

   <figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FQ0FNll8Fe4PjEQ8MvbZm%2FScreenshot%202022-11-25%20at%2000.16.56.png?alt=media&#x26;token=7768fb26-eec3-4c1c-be46-0fc827d4dd0d" alt=""><figcaption></figcaption></figure>

4. Preview your metric. You can make changes to your query and reload the data from Datadog. Note that once you have created your metric, you will no longer be able to change the metric query.&#x20;

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F4Qw0z8OJPJq0TzzGWbzj%2FScreenshot%202022-11-25%20at%2000.28.29.png?alt=media&#x26;token=9fce89e1-c835-43a0-b3f8-16a54e4f7dee" alt=""><figcaption></figcaption></figure>

### Further References <a href="#faq" id="faq"></a>

Here are the articles on how to connect Datadog and ilert: \
\
[Datadog Inbound Integratio](https://docs.ilert.com/integrations/inbound-integrations/datadog)&#x20;
