# Dotcom-Monitor Integration

[Dotcom-Monitor](https://www.dotcom-monitor.com/) is a web performance and availability monitoring platform. By integrating Dotcom-Monitor with ilert, you can route monitor failures to on-call responders in ilert and centralize escalation and incident response.

## In ilert: Create a Dotcom-Monitor alert source

1. Go to **Alert sources** -> **Alert sources** and click **Create new alert source**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FjX0cS4q7woTXKajZmc1W%2FScreenshot%202023-08-28%20at%2010.21.10.png?alt=media&#x26;token=8ef3666b-84eb-4b51-abee-f07303313941" alt=""><figcaption></figcaption></figure>

2. Search for **Dotcom-Monitor** in the search field, click the Dotcom-Monitor tile, and then **Next**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FlXzQlJpaTFSR49AZk0xA%2FScreenshot%202023-08-28%20at%2010.24.23.png?alt=media&#x26;token=cffeacb4-57b9-47d4-827d-b0f6b1afd914" alt=""><figcaption></figcaption></figure>

3. Give your alert source a name, optionally assign teams, and click **Next**.
4. Select an **escalation policy** by creating a new one or assigning an existing one.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FNnuZqONaIhbOf6fn4OkZ%2FScreenshot%202023-08-28%20at%2011.37.47.png?alt=media&#x26;token=8a74f7b5-5bd2-4eea-97fa-1c1dbb041333" alt=""><figcaption></figcaption></figure>

5. Select your [Alert grouping](https://docs.ilert.com/alerting/configure-alerting/alert-sources#alert-grouping) preference and click **Continue setup**. You may click **Do not group alerts** for now and change it later.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FueugN4JgHn1c90ggFA6u%2FScreenshot%202023-08-28%20at%2011.38.24.png?alt=media&#x26;token=b8009daf-3ca8-4264-a6fa-e42ef7333205" alt=""><figcaption></figcaption></figure>

6. The next page shows additional settings, such as custom alert templates or notification priority. Click **Finish setup** for now.
7. On the final page, copy the generated **Dotcom-Monitor URL**. You will use this URL in Dotcom-Monitor.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-ae05ab0db61dc0f1df949b0bb37f39442e3b55a1%2Fdotcom-monitor-01-ilert-alert-source-url.png?alt=media" alt=""><figcaption></figcaption></figure>

## In Dotcom-Monitor: Create a custom alert template

1. In the Dotcom-Monitor dashboard, click **Manage** in the left navigation.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-97e64a42c08f01da0540e463239b588c51574d7f%2Fdotcom-monitor-02-manage-menu.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Click **Custom Alert Templates**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-8ad5c2ce463456f3270b988dae84486466eb2a74%2Fdotcom-monitor-03-custom-alert-templates-menu.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Click **+ New Template**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-cfb0bb1f2a429c9c5e9a56d803b4e0683a489aa0%2Fdotcom-monitor-04-custom-alert-templates-new-template.png?alt=media" alt=""><figcaption></figcaption></figure>

4. Enter a template name (for example, **ilert template**) and set the format to **Json**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-ab2428e1822e3aeb72ae5bc785194bcf43c41657%2Fdotcom-monitor-05-custom-alert-template-form.png?alt=media" alt=""><figcaption></figcaption></figure>

5. Paste the following template body:

```json
{
    "monitor": { 
        "MonitorName": "@Model.RootResponse.Monitor.Name",
        "MonitoringTime": "@Model.Monitor_DateTime"
    },
    "device": @{
    var device = Model.RootResponse.Device;
    }
    {
        "PlatformType": "@device.PlatformType",
        "DeviceName": "@device.Name",
        "Tags": [
            @if (device.Tags != null)
            {
                foreach (var tag in device.Tags)
                {
                    <text>
                        {
                        "Name": "@tag.Name",
                        "Color": "@tag.Color"
                        }
                        @if(tag != device.Tags.Last()){ <text>,</text> }
                    </text>
                }
            }
        ],
        "DeviceReportingUrl": "@Model.OnlineReportLink?CUID=@Model.OnlineReportCUID"
    },
    "errorDetails": [@foreach (var sessionResponse in Model.SessionResponses)
    {
        foreach (var response in sessionResponse.Children)
        {
            <text>
                {
                "TaskType": "@response.Task.TaskType_Name",
                "DetailsUrl": "@Model.DMUserLink/client/response-details/hit?id=@response.ID&StartTime=@response.StartTimeJson&rootId=@Model.RootResponse.ID&cuid=@Model.OnlineReportCUID",
                "ViewTaskUrl": "@Model.DMUserLink/v2/EditLegacyTask/@response.Device.ID/@response.Task.ID",
                "TaskName": "@response.Name",
                "Target": "@response.Target",
                "Errors": [
                @if (response.AllErrors != null)
                {
                    foreach (var error in response.AllErrors)
                    {
                        <text>
                            {
                            "ErrorType": "@error.ErrorType",
                            "ErrorCode": "@error.ErrorCode",
                            "Reason": " @error.Reason"
                            }
                            @if(error != response.AllErrors.Last()){ <text>,</text> }
                        </text>
                    }
                }
                ]
                }
            </text>
        }
    }],
    "monitoringResults": [@foreach (var response in Model.LastXResponses)
    {
        <text>
            {
            "MonitorName": "@response.Monitor.Name",
            "Status": "@(response.IsFail ? "Error" : "Ok")",
            "Start": "@response.Start",
            "DetailsUrl": "@Model.WaterFallLink?id=@response.ID&StartTime=@response.StartTimeJson"
            }
            @if(response != Model.LastXResponses.Last()){ <text>,</text> }
        </text>
    }],
    "firstError": {
        "DownStateResponseMonitorName": "@Model.DownStateResponse.Monitor.Name",
        "StartMonitorDowntime": "@Model.StartMonitorDowntime"
    }
}
```

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-586fe5aee8ed0454da16b2fb11d47571c9c255c2%2Fdotcom-monitor-06-custom-alert-template-body.png?alt=media" alt=""><figcaption></figcaption></figure>

6. Click **Validate**, then click **Create Template**.

## In Dotcom-Monitor: Create a delivery address group

1. In Dotcom-Monitor, go to **Manage** -> **Delivery Address Groups**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-c2f8ae3abace4c232cff7cb4e49a70dc8d67e0f1%2Fdotcom-monitor-07-delivery-address-groups-menu.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Click **+ New Group**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-496268bcd0147cb294e33d0e104fa25ab178edc3%2Fdotcom-monitor-08-delivery-address-groups-new-group.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Enter a group name (for example, **ilert group**) and optional description.
4. Click **New Address**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-51486f8f9220e26f425ef8bf49900b2a3718d017%2Fdotcom-monitor-09-delivery-group-page-new-address.png?alt=media" alt=""><figcaption></figcaption></figure>

5. Select **Webhook** as the delivery address type.
6. In **Webhook URL**, paste the Dotcom-Monitor URL you copied from ilert.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-40d7779168ee906231a24eccbcafe53943bea529%2Fdotcom-monitor-10-delivery-address-webhook-url.png?alt=media" alt=""><figcaption></figcaption></figure>

7. Set **Request Type** to **POST**.
8. Expand **Post Data** and configure:
   * **Data Type:** Raw
   * **Content Type:** JSON
   * **Body:** select the previously created **ilert template**

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-a4c590528921459e8b4594cd9f50e52127f4aac4%2Fdotcom-monitor-11-delivery-address-post-data.png?alt=media" alt=""><figcaption></figcaption></figure>

9. Click **Done**, then click **Create Group**.

## In Dotcom-Monitor: Assign the delivery group to a monitor

1. Open the monitor (device) you want to alert on.
2. Go to **Alerts** settings for that monitor.
3. In **Delivery Address Groups**, click **Select Groups**.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fgit-blob-e5cd7b7b7910731de1f5908fd4c3fc7b75ae4114%2Fdotcom-monitor-12-monitor-alert-settings-select-groups.png?alt=media" alt=""><figcaption></figcaption></figure>

4. Select the previously created group (for example, **ilert group**).
5. Keep escalation behavior as needed (for example, **Immediate**) and enable/disable **Resend Uptime Alert** based on your notification preference.
6. Click **Save Changes** or **Save & Close**.

## FAQ

#### **Will alerts in ilert be resolved automatically?**

Yes. When Dotcom-Monitor sends a recovery event for the same monitor, ilert resolves the corresponding alert automatically.
