# Alerts and reports

> Hear when nobody is online, 404s spike or sign-ups stop, by email, Telegram, Slack or a signed webhook, and get a weekly or monthly report of each site.

Source: https://mettr.app/docs/alerts-and-reports

An alert watches one number and tells you once when it goes wrong, and once when it is right again. A long outage is two messages, not one a minute. Alerts and reports come with the Pro plan; the number of alerts a site may have is on the [pricing](/pricing) page.

## Add an alert

Open the bell on a site's dashboard, or the site's **Alerts** page. Start from a suggestion (**Nobody online**, **A wave of 404s**, **Exceptions above usual**, **Sign-ups stopped**) or from scratch: what to count, as in a panel, then the condition.

## Conditions

- **A number**: the count over a window of 5 to 60 minutes is above or below a number. "404s in 5 minutes above 50", "`payment.failed` in 15 minutes above 10".
- **Against the usual**: the count over the window is below or above a share of the usual, the median of the same window on each of the seven days before. "Views this hour below 30% of usual".
- **Who is online**: the number of visitors online stays at or below a number for the whole window. "Nobody online for 10 minutes".

## Quiet by design

- A **floor**: an alert against the usual, or on who is online, fires only when the usual for that window is above it. A small site with nobody on it at 4 in the morning is normal, not an outage.
- A **cooldown** between firings, from 15 minutes to a day.
- **Quiet hours** in the site's time zone.
- **Mute** an alert for an hour, a few hours, a day or a week.

Alerts are checked every minute, on the minute that has just ended. An alert recovers as soon as the number is back on the right side; the floor, cooldown and quiet hours only hold back firing.

## Channels

Channels belong to the team and serve all its sites. Each has a **Send test** button and shows how its last message went.

- **Email to the team**: to every member with a confirmed address.
- **Telegram**: a bot's token and a chat.
- **Slack**: an incoming webhook (`https://hooks.slack.com/…`).
- **Webhook**: a JSON `POST` to an https address of yours.

Messages carry the site, the condition, the value, the usual and a link to the dashboard, never anything about a visitor. Tokens and webhook addresses are encrypted at rest and never shown again.

## Webhooks

Each request has a `Mettr-Event` header (`alert.fired`, `alert.recovered`, `alert.test`, `report.weekly`, `report.monthly`) and a `Mettr-Signature` header:

```http
Mettr-Signature: t=1764581400,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
```

`v1` is the hex HMAC-SHA256, with the channel's secret (`whsec_…`, shown once), of the time `t`, a full stop, and the raw body. Check it before reading the body, and refuse a `t` more than a few minutes old:

```php
[$t, $v1] = sscanf($request->header('Mettr-Signature'), 't=%d,v1=%s');
$expected = hash_hmac('sha256', $t.'.'.$request->getContent(), $secret);

abort_unless(hash_equals($expected, (string) $v1) && abs(time() - $t) < 300, 401);
```

An alert's body:

```json
{
    "type": "alert.fired",
    "alert": {"id": 12, "name": "Nobody online"},
    "site": {"id": 7, "name": "Docs"},
    "condition": "online at or below 0 for 10 minutes",
    "value": 0,
    "usual": 14,
    "url": "https://mettr.app/dash/acme/sites/docs",
    "at": "2026-12-01T03:12:00Z"
}
```

The address must be https to a public host. It is checked when it is added and again on every send, and redirects are not followed.

## Reports

On the **Alerts** page, tick the channels that should get the site's **weekly** report (Monday to Sunday) or **monthly** one. Each goes out at 08:00 in the site's time zone the morning after the period ends; **Send now** sends the last one at once.

A report says what the dashboard says for that stretch: visitors, visits, views, bounce rate and visit duration against the stretch before; the top five sources, pages and events; exceptions and 404s; and a link to the dashboard on that range. Counts and names only. A webhook gets it as JSON, signed as alerts are.
