# Alerts

> Where Lumen tells you that a run failed or spending jumped, what an alert policy says, and how to read the Alerts page and the notifications bell.

Source: https://docs.go-lumen.ai/he/operate/alerts

Lumen tells you about your flows in two places: the notifications bell, which works now, and alert policies, which say who should hear about what. This page shows both, and is plain about which parts are ready.

-   Console, YAML and CLI
-   Policies are read-only in the console

## What is live

|  | State |
| --- | --- |
| **Notifications bell** in the console | Live. Workspace admins get a notification when a run fails and when the workspace passes 80% and 100% of its monthly budget. Approvals, problem reports and a few system events arrive there too. |
| **Alert policies** (the `AlertPolicy` resource) | The resource is stored and shown on the **Alerts** page. Nothing turns a policy into a message, so do not rely on one as your only way to hear about a failure. |

## The notifications bell

The bell is at the top of the console's left column and shows how many notifications are unread. Click it to open the list.

![The Notifications drawer. Tabs All and Unread (3), and an All kinds filter. The first item, with a red icon, reads A run of Handle invoices that arrive by email failed, with the reason The scan is blank, there is no text to read, 3 hours ago. The second, with a coin icon, reads You have used 80% of this month's credits, About 1,000 credits are left until the 1st. Below are a member joining, a fixed problem report, a message from a flow and a weekly summary.](https://docs.go-lumen.ai/he/img/operate/alerts-02-notifications.png)

*The bell. Unread items have a blue dot; the filter narrows by kind.*

-   Click a notification to open what it is about: the run, the flow, billing or your files.
-   The **...** menu on an item marks it read or unread, or deletes it. **Mark all read** is in the drawer's menu.
-   **All kinds** filters by **Failed runs**, **Approvals**, **Budget**, **Problem reports**, **Workspace**, **From your flows**, **Waiting for a worker** and **Paused flows**.
-   Notifications are kept for 90 days.

A flow can also send its own in-app notification with a step, which appears under **From your flows**.

## The Alerts page

Open **Alerts** under **Monitor** in the console. It lists your workspace's alert policies, one row each:

![The Alerts page. A table titled Alerts with columns When, Notifies and Status. One row reads A run fails, notifies dana@acme.test via slack-finance. A second reads Spend goes over a limit, per 24h, notifies dana@acme.test. Both have a green dot and the status True. Below the table a panel reads Sent alerts will be listed here. Coming soon.](https://docs.go-lumen.ai/he/img/operate/alerts-01-alerts-page.png)

*Each policy says when it applies and who it notifies. The history panel is not built yet.*

| Column | Meaning |
| --- | --- |
| **When** | **A run fails**, **Spend goes over a limit** (with its window, such as `per 24h`) or **A run looks unusual**, which also shows its sensitivity. |
| **Notifies** | The addresses and connections the policy names. A connection shows as `via` and its name. |
| **Status** | The policy's Ready condition. **Waiting** means nothing has reported on it yet. |

The page only reads. A policy is configuration, so you create and change it as a resource, not in a form.

## Write an alert policy

An [`AlertPolicy`](https://docs.go-lumen.ai/he/reference/resources/alertpolicy.md) has three parts: which flows it covers, the condition, and where to notify.

**YAML:**

```yaml title="invoice-failures.yaml"
apiVersion: lumen.ai/v1alpha1
kind: AlertPolicy
metadata:
  name: invoice-failures
  namespace: tenant-acme
spec:
  flows:
    matchLabels: {lumen.ai/owner: git}
  when:
    type: RunFailed
  notify:
    - email: ops@acme.example
```

**CLI:**

```bash title="Apply it and list the policies"
lumen apply -f invoice-failures.yaml
lumen get alertpolicies
```

`lumen edit alertpolicies invoice-failures` changes one, and `lumen delete alertpolicies invoice-failures` removes it.

**Console:**

The console lists policies and does not edit them. Use YAML or the CLI.

| Field | What it does |
| --- | --- |
| `spec.flows` | A label selector. Empty means every flow in the workspace. |
| `spec.when.type` | `RunFailed`, `CostOver` or `Anomaly`. |
| `spec.when.costOver` | Required with `CostOver`: `amountUSD` and a `window` such as `1h` or `1d`. |
| `spec.when.anomaly` | Used with `Anomaly`: `sensitivity` of `low`, `medium` (the default) or `high`. |
| `spec.notify` | At least one target. Each is either an `email` or a `connectorRef` to a connection that can notify, never both. |

A spend alert looks like this:

```yaml title="spend-spike.yaml"
apiVersion: lumen.ai/v1alpha1
kind: AlertPolicy
metadata:
  name: spend-spike
  namespace: tenant-acme
spec:
  when:
    type: CostOver
    costOver:
      amountUSD: "25"
      window: 1d
  notify:
    - email: dana@acme.example
```

> **Budgets are separate:**
> 
> A policy watches for spend. To stop spend, set a budget, which holds new runs when it is reached. See [Billing and usage](https://docs.go-lumen.ai/he/operate/billing-and-usage.md#budgets).

## Next steps

[Runs, retries and historyOpen the run behind a failure notification and run it again.](https://docs.go-lumen.ai/he/operate/runs-and-retries.md)[Billing and usageSet a budget so spend stops at a number you chose.](https://docs.go-lumen.ai/he/operate/billing-and-usage.md)[When a run failsHandle errors inside the flow.](https://docs.go-lumen.ai/he/build/when-a-run-fails.md)
