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

# Mackerel alert integration

> Send Mackerel alerts to Flashduty On-call through a Webhook notification channel; alerts recover automatically when they close.

Use a Mackerel Webhook notification channel to send Mackerel alerts to Flashduty On-call. Each Mackerel alert maps to one Flashduty alert: it triggers when the alert opens, updates when its status changes between Warning and Critical, and recovers when the alert closes.

<div className="hide">
  ## In Flashduty On-call

  ***

  You can obtain an integration push URL in either of the following ways.

  ### Use a dedicated integration

  1. In the Flashduty console, select **Channel** and open a channel
  2. Select **Configuration** → **Integrations** → **Private integration**, then click **Add an integration**
  3. Select **Mackerel**, then click **Save**
  4. Open the generated integration card and copy the **Push URL**

  ### Use a shared integration

  1. In the Flashduty console, select **Integration Center → Alert Events**
  2. Select **Mackerel** and enter an integration name
  3. Configure the default route and select a channel; after creation, add more rules under **Route** if needed
  4. Click **Save** and copy the generated **Push URL**
</div>

## Configure Mackerel

***

<Steps>
  <Step title="Add a Webhook notification channel">
    1. Sign in to Mackerel and click **Channels** in the left menu
    2. Create a notification channel and choose **Webhook** as its type
    3. Enter a channel name and paste the full Flashduty push URL into **URL**. The URL must include `integration_key`
    4. Under the events to notify, select only the alert (`alert`) event. Alert group, host status, host registration, host retirement, and monitor change events do not create alerts; Flashduty acknowledges them and returns success
    5. The graph image option (Include graph image) is on by default and adds a graph link to the alert labels; clear it if you don't need the link
    6. Save the channel
  </Step>

  <Step title="Add the channel to a notification group">
    A new channel is added to the default notification group, which receives every notification in the organization. To send only some services or monitors to Flashduty, create a notification group on the **Channels** page, select those services and monitors, add the channel to that group, and remove it from the default notification group.
  </Step>

  <Step title="Verify">
    1. In **Monitors**, pick a monitor (for example, a host metric monitor) and temporarily lower its threshold so that it opens an alert
    2. Confirm that Flashduty receives an active alert
    3. Restore the threshold. After Mackerel closes the alert, confirm that the Flashduty alert recovers. You can also click **Close alert** on the Mackerel alert page to close it manually; Flashduty recovers the alert in the same way
  </Step>
</Steps>

## Alert Key

***

Flashduty uses the Mackerel alert's `alert.id` as the Alert Key. A Mackerel alert keeps the same ID from the moment it opens, through status changes, until it closes, so these notifications merge into one Flashduty alert.

When the same monitor fires again after its alert closed, Mackerel creates a new alert ID and Flashduty creates a new alert. Changes to the monitor name, message, metric value, or host status do not change the Alert Key. Alert notifications without `alert.id` are rejected.

## Status and severity

***

| Mackerel `alert.status` | `alert.isOpen` | Status | Flashduty severity |
| :- | :- | :- | :- |
| `critical` | `true` | Triggered | Critical |
| `unknown` | `true` | Triggered | Critical |
| `warning` | `true` | Triggered | Warning |
| `ok` | - | Recovered | Info |
| `critical`, `unknown`, `warning` | `false` | Recovered | Same mapping as when triggered |

Mackerel ranks Unknown at the same level as Critical, so Flashduty maps it to Critical. Closing an alert manually, deleting its monitor, retiring its host, or deleting its service all close the alert (`alert.isOpen` is `false`), and Flashduty recovers the alert.

## Labels

***

| Label | Source |
| :- | :- |
| `check` | Monitor name, `alert.monitorName` |
| `resource` | Host name, or the service name for service metric alerts |
| `host` / `host_id` / `host_status` / `host_url` | Host name, host ID, host status (`working`, `standby`, and so on), and host details link; host alerts only |
| `service` / `service_id` | Service name and service ID; service metric alerts only |
| `roles` | Role full names (`service: role`), comma-separated |
| `org` | Mackerel organization name |
| `monitor_type` | Monitor type, such as `connectivity`, `host`, `service`, `external`, `check`, `expression`, or `anomalyDetection` |
| `alert_id` | Mackerel alert ID |
| `alert_status` | Raw Mackerel alert status |
| `trigger` | What triggered the notification, such as `monitor` (monitor evaluation), `manual close`, `retire host` or `delete monitor` |
| `metric` / `metric_value` | Monitored metric name and its value at detection |
| `url` | Mackerel alert details link |
| `image_url` | Image link of the related graph; requires the graph image option |

The alert `message` and the monitor `memo` are written to the alert description.

## Troubleshooting

***

* **Flashduty returns a parameter error**: Make sure the URL is complete and includes `integration_key`
* **No alerts arrive**: Make sure the channel subscribes to the alert (`alert`) event, the channel's notification group includes the monitor, the host status is `working` (Mackerel does not send alert notifications for hosts in `standby`, `maintenance`, or `poweroff`), and the monitor's notifications are not muted
* **Only Critical alerts arrive**: The notification group has **Critical only** turned on, so Warning alerts are not sent
* **The channel shows as suspended**: Mackerel suspends a channel after its notifications keep failing for a period of time. Fix the push URL, then click the warning icon next to the channel to unsuspend it
* **Restricting source IPs**: See the Mackerel FAQ entry on the source IP addresses of notifications

For more on the payload fields, see [Mackerel Webhook](https://mackerel.io/docs/entry/howto/alerts/webhook).
