# Monitors

> Run a query on a schedule and turn each new row into a signal.

A monitor watches a [data source](https://pulso.run/docs/concepts/data-sources.md). On a SQL database source it runs a query on a schedule; on a webhook or form source it runs on every event or submission. Each row that passes its filters and hasn't been seen before becomes a [signal](https://pulso.run/docs/concepts/signals.md).

Admins and operators can create and edit monitors. Only admins can activate, pause, archive or unarchive them.

## Create a monitor

There are two ways:

- From the [explorer](https://pulso.run/docs/concepts/data-sources.md#explore-a-database): click **Create monitor**. Pulso creates a paused monitor with your query and opens it so you can pick its **Uniq by** columns.
- From **Build → Monitors**: click **Add monitor**, fill in **Name**, **Data source** and **Category**, and click **Save**.

New monitors start paused.

## Configure it

The edit page has two parts.

**Details**

- **Name** and **Description**.
- **Category**: groups monitors on the **Monitors** page.
- **Data source**.
- **Frequency**: how often the query runs. Only for SQL database sources.
- **Assignee**: a member or a team that new signals are assigned to, or **No assignee**.
- **Priority** of new signals: **Low**, **Medium**, **High** or **Critical**.
- **Only notification**: see [Notification-only monitors](https://pulso.run/docs/concepts/monitors.md#notification-only-monitors).

**Config**

- The **SQL Query** editor, with **Format** (⌘F) and a panel with the data source's tables.
- **Preview Query** (⌘↵) runs the query and shows its results.
- Filters and **Uniq by**, below the results.

Click **Save** to keep your changes.

![Editing a monitor's query](https://pulso.run/assets/website/monitor-query-0c3c1204.png)

### Frequency

| Option | Settings |
|---|---|
| **Every 5 minutes** | None |
| **Hourly** | Minutes |
| **Daily** | Hour and minutes |
| **Weekly** | Day, hour and minutes |
| **Custom** | A cron expression in **Frequency cron**, for example `5 4 * * *` |

A monitor can't run more often than every 5 minutes.

### Query limits

- The query runs in a read-only transaction and is stopped after 60 seconds.
- It must return at most 200 rows. A check that gets more fails, so narrow the query down to the rows that need attention.

You can use [account variables](https://pulso.run/docs/concepts/variables-and-address-book.md#variables) in the query, for example `WHERE amount > {{vars.min_amount}}`. Pulso inserts them as quoted literals. If a variable isn't defined, the check fails.

### Filters

Under the results, **Add filter** narrows down the rows after the query runs. Each filter has a field, a kind and an operation:

| Kind | Operations |
|---|---|
| `string` | `contains`, `equals`, `starts_with`, `ends_with` |
| `number` | `equals`, `greater_than`, `less_than` |
| `boolean` | `is_true`, `is_false` |

Filters are the only way to select rows on a webhook source, since it has no query.

### Uniq by

**Uniq by** lists the columns that tell one row from another. Tick **Uniq by this column** on those columns in the results grid.

Pulso combines their values into the signal's **Reference**. A monitor creates at most one signal per reference, ever: if a row with the same values shows up again, even after its signal was resolved, no new signal is created.

> **Caution**
>
> Without uniq by columns, every row of every check becomes a new signal. Pulso warns you: "This monitor cannot recognise rows it has already seen".

## Activate, pause and archive

The status menu on the monitor shows **Active**, **Paused** or **Archived**, and lets admins change it.

### Activate and prefetch

When you click **Resume** on a paused SQL monitor, Pulso asks how to start:

- **Activate and prefetch** runs the query once and stores the rows it returns as already seen. Only rows that appear later become signals.
- **Activate without prefetching** treats every row of the next check as new.

If the monitor has no uniq by columns, the dialog offers **Activate anyway** instead, since there is nothing to prefetch against.

The same choice appears when you save changes to the query, filters, uniq by columns or data source of an active monitor: **Continue and prefetch**, **Save without prefetching**, or **Back to edit**.

### Pause, archive and delete

- **Pause** stops the checks. **Resume** starts them again.
- **Archive** pauses the monitor and hides it, along with its signals, from the rest of the app. Archived monitors are listed under **Archived** on the **Monitors** page.
- **Unarchive** brings it back, paused.
- **Delete** is only available on archived monitors. It erases the monitor and all its signals and data.

## Failed checks

A check fails when the query errors, times out, returns too many rows, or uses an undefined variable. Admins and operators get an email, "Check for *monitor name* failed", and you can open the check from the monitor's **Checks** tab to see the error.

The **Monitors** page shows each monitor's last run and whether it succeeded, and you can filter by name, data source and status.

## The monitor page

- **Clone** creates a copy. **Edit** opens the editor.
- Properties: creation and update dates, data source, category, frequency and priority.
- **Playbook**: the steps every new signal follows, as a numbered document or a flow, with a link to edit them. See [Playbooks](https://pulso.run/docs/concepts/playbooks.md).
- **Overview**: tabs with the monitor's **Signals**, **Checks**, **Notifications** and **Audits**.

## Webhook monitors

A monitor on a webhook source has no query and no frequency. Every event received by the source goes through the filters of each active monitor on it, and each match creates a signal. Uniq by works the same way, using the flattened payload keys as columns (`customer.email`).

## Notification-only monitors

Turn on **Only notification** for monitors that only need to tell someone. Their signals have no priority, status or assignee, and their playbook only runs notification steps. Other steps stay saved but inactive.

Notification-only signals are left out of the **Report**.

## Categories

Categories group monitors on the **Monitors** page. Drag a monitor onto another category to move it. Manage them from **Settings → Categories**:

- Admins and operators can create and rename categories.
- Admins can delete them. The monitors of a deleted category move to the default category.
- The default category, **Default** in a new account, can't be deleted. Admins can choose another default under **Settings → Account**.
