# Dynatrace

EvoHub receives Dynatrace problems through a **Custom integration** problem notification. An open problem opens an EvoHub alert, and the resolved notification resolves it. The custom payload Dynatrace fills in for you works as it is.

## Set it up

:::steps
### Create the integration
In EvoHub, go to **On-Call → Integrations → + Add Integration**, choose **Dynatrace**, pick an **Escalation Policy** and click **Create Integration**. Copy the **Webhook URL**.
### Add a problem notification
In Dynatrace, go to **Settings → Integration → Problem notifications** (under **Settings Classic** in the latest Dynatrace), click **Add notification** and choose **Custom integration**.
### Set the URL
Set **Webhook URL** to your webhook URL and leave the pre-filled **Custom payload** as it is. The `{…}` parts are Dynatrace placeholders.

```text
https://evohub.io/ingest/dynatrace?key=YOUR_INTEGRATION_KEY
```
### Add severity and details (optional)
For a better severity and a fuller description, add these two lines to the payload:

```json
"ProblemSeverity": "{ProblemSeverity}",
"ProblemDetailsText": "{ProblemDetailsText}",
```
:::

The pre-filled payload contains `{ImpactedEntities}` and `{ProblemDetailsJSON}` without quotes, so they arrive as JSON arrays and objects. EvoHub reads that as it is; you do not need to quote them.

## Turn on auto-resolve

Nothing extra is needed. Dynatrace sends the notification again with `State` **RESOLVED** when the problem closes, and EvoHub resolves the matching alert.

## What EvoHub reads

| EvoHub alert | Taken from |
| --- | --- |
| Title | `ProblemTitle` (or "Dynatrace Problem"). |
| Description | `ProblemDetailsText`; without it, the problem's URL (`ProblemURL` or `Problem URL`). |
| Link | The problem's URL, whatever the description. It opens from the alert. |
| Labels | `impact` (`ProblemImpact`), `impacted_entity` (`ImpactedEntityNames` or `ImpactedEntity`) and `tags` (`Tags`), when sent. |
| Fingerprint | `PID`, the problem's system-wide ID; without it, `ProblemID`. |

### Severity

Severity comes from `ProblemSeverity`. Add it to the payload as shown above; without it every problem is **medium**.

| Dynatrace severity | EvoHub severity |
| --- | --- |
| AVAILABILITY | critical |
| ERROR | high |
| MONITORING_UNAVAILABLE | high |
| PERFORMANCE, RESOURCE_CONTENTION | medium |
| CUSTOM_ALERT | low |
| INFO | info |
| missing or anything else | medium |

## Resolve and deduplication

- `State` **RESOLVED** resolves the open alert with the same `PID`. Any other state, such as **OPEN**, opens an alert.
- Further notifications for a problem whose alert is still open are recorded as **Retriggered**.

## Troubleshooting

- **`401 INVALID_KEY`**: the URL's key is wrong or the integration is disabled. Copy the **Webhook URL** again from the integration.
- **`400 INVALID_BODY`**: the edited payload is no longer valid JSON. A missing comma after a line you added is the usual cause.
- **Every alert is medium**: add `"ProblemSeverity": "{ProblemSeverity}"` to the payload.

## Related

- [Integrations overview](https://docs.evohub.io/integrations-overview.md)
- [New Relic](https://docs.evohub.io/new-relic.md)
- [Escalation policies](https://docs.evohub.io/escalation-policies.md)
