> For the complete documentation index, see [llms.txt](https://docs.decube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decube.io/data-quality-v2/create-monitors-in-bulk-with-templates.md).

# Create monitors in bulk with Templates

Bulk apply preset rules across an entire source or schema.

Setting up Freshness monitoring one table at a time gets slow as soon as you are covering a whole schema or a whole layer of your warehouse. A template holds a single configuration, its schedule, detection method, threshold, attributes, and naming rule, and applies that configuration to as many tables as you select. Each table you select gets one monitor.

{% hint style="info" icon="road" %}
Today, Templates support two monitor types: **Freshness - Staleness** and **Freshness - SLA**. More monitor types may be added soon.
{% endhint %}

Creating, editing, and deleting templates requires the **Manage Templates** permission, granted through the [Data Quality V2 module-based policy](/group-access-policies/module-based-policies.md#data-quality-v2).

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2Fa3rJOaOB9pkmjsgKwjXC%2FTemplates%20(1).png?alt=media&amp;token=235a6a42-e169-4bf1-b731-3ef1d40587a1" alt=""><figcaption></figcaption></figure>

{% embed url="<https://youtu.be/ni25QewTixU>" %}

### What a template holds <a href="#what-a-template-holds" id="what-a-template-holds"></a>

| Field                             | What it does                                                                                                                                         |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Template name and description** | Identifies the template on the Templates tab. The description is optional, and it is the right place to record which tables the template belongs on. |
| **Monitor type**                  | Fixes the type of monitor the template creates. This is the only field you cannot change later.                                                      |
| **Monitor name pattern**          | Generates a name for every monitor the template creates, resolved against each table.                                                                |
| **Data quality dimension**        | Tags every monitor the template creates with a DQ dimension.                                                                                         |
| **Attributes**                    | Applies the same custom attribute values to every monitor the template creates.                                                                      |
| **Schedule**                      | Sets how often those monitors run.                                                                                                                   |
| **Detection method**              | Sets where each monitor reads the table's last write time from.                                                                                      |
| **Threshold**                     | Sets how old the data is allowed to get before the monitor raises an incident.                                                                       |

### Create a template <a href="#create-a-template" id="create-a-template"></a>

1. Go to **Data Quality > Templates** and click **Create template**.
2. Enter a **Template name**, and a description if you want one.
3. Select the **Monitor type**, either **Freshness - Staleness** or **Freshness - SLA**.
4. Fill in the configuration sections described below.
5. Click **Create template**.

The monitor type you pick determines which configuration fields render, so select it before you work through the rest of the form.

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2F9rQtRglZQTEe9QtOeIdw%2FSCR-20260917-nwdt.png?alt=media&amp;token=f2725bcc-3700-437e-9713-406dadeb3dbf" alt=""><figcaption></figcaption></figure>

#### Name the monitors it creates <a href="#name-the-monitors-it-creates" id="name-the-monitors-it-creates"></a>

The **Monitor name pattern** is free text with tokens in it. Every monitor created from the template gets a name built by substituting each token with the values of the table that monitor runs on.

| Token            | Resolves to                               |
| ---------------- | ----------------------------------------- |
| `{{TableName}}`  | The name of the table the monitor runs on |
| `{{SchemaName}}` | The schema that table belongs to          |
| `{{SourceName}}` | The source that schema belongs to         |

Use the **Insert token** buttons to add a token at the cursor, and check the **Preview** line below the field to see how a name resolves. A pattern of `Freshness - {{TableName}} {{SchemaName}}` applied to `orders` in `analytics` produces the monitor name `Freshness - orders analytics`.

{% hint style="info" %}
Tokens substitute on an exact match. `{{Table Name}}` and `{{Tablename}}` stay in the monitor name as literal text, so use the Insert token buttons rather than typing tokens by hand.
{% endhint %}

#### Choose a detection method <a href="#choose-a-detection-method" id="choose-a-detection-method"></a>

The detection method decides where each monitor reads the table's last write time from.

* **Reported by source (Automatic)** reads the last-modified time the source reports for the table. It needs no per-table setup, so it applies cleanly across every table you select.
* **Specific column** reads the maximum value of a timestamp column on the table. Because the column carrying that timestamp is rarely named the same way across every table, you give the template an ordered list of regex patterns instead of a column name, and each monitor resolves its own column at the point you apply the template.

Selecting **Specific column** opens a **Column name pattern** section. Add one pattern per row with **Add pattern**, order them from the most specific to the most general, and use the control beside a row to remove it. For each table, Decube works down the list and stops at the first pattern that produces a single column:

| Outcome for a pattern        | What happens                                                   |
| ---------------------------- | -------------------------------------------------------------- |
| Matches exactly one column   | That column is selected and the remaining patterns are skipped |
| Matches more than one column | No column is selected and the remaining patterns are skipped   |
| Matches no column            | Decube moves on to the next pattern in the list                |

A list of `^updated_at$`, then `^modified_at$`, then `_at$` picks up `updated_at` where it exists, falls back to `modified_at`, and only then reaches for anything else ending in `_at`. Any table where the list resolves nothing is flagged for you at the review step, so a pattern that misses a few tables costs you a fill-in rather than a failed batch.

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2FjukLTgicWJOJDptTmZt3%2FSCR-20260917-nypj.png?alt=media&amp;token=efde33d2-8d58-4223-928a-df321a6a934c" alt=""><figcaption></figcaption></figure>

{% hint style="warning" icon="question" %}
A pattern matching two or more columns stops the list rather than continuing to the next pattern. An ambiguous match means Decube cannot tell which column you meant, and falling through to a broader pattern would pick a column you did not intend. Tighten the pattern with anchors, for example `^updated_at$` instead of `updated`.
{% endhint %}

#### Set the threshold <a href="#set-the-threshold" id="set-the-threshold"></a>

The **Threshold** is the maximum age the data on a table is allowed to reach. Enter a positive value and a unit, for example 6 hours. Each monitor created from the template starts with this figure, and raises an incident when the age of the data on its table passes it.

#### Set the schedule <a href="#set-the-schedule" id="set-the-schedule"></a>

The schedule sets how often the monitors run. Pick a frequency, then set the day and time fields that frequency needs, and the timezone the schedule is anchored to.

#### Apply attributes and a DQ dimension <a href="#apply-attributes-and-a-dq-dimension" id="apply-attributes-and-a-dq-dimension"></a>

Both of these carry from the template onto every monitor it creates, and both feed the filters and alert routing you use later.

* **Data quality dimension** tags the monitors with a single dimension, for example Timeliness for Freshness work.
* **Attributes** are your organisation's custom attributes. Select the attributes you want to set, then enter a value for each one. The input matches the attribute's type, so a text attribute takes free text, a number attribute takes a figure, a select attribute offers your configured options, and a boolean attribute offers True or False.

Attributes apply uniformly across the batch. You cannot vary an attribute value monitor by monitor at the review step.

### Apply a template to your tables <a href="#apply-a-template-to-your-tables" id="apply-a-template-to-your-tables"></a>

Creating monitors is a separate action from building the template, and you can run it as many times as you want against the same template. There are two entry points:

* Open the template and click **Create monitors** on the Template Details page.
* Use the row menu for the template on the **Templates** tab and select **Create monitors**.

Both open the same two-step flow. The template's configuration stays pinned in a summary card at the top of both steps, so you can see the schedule, detection method, threshold, dimension, and attributes you are about to apply.

#### Step 1: Select the assets to monitor <a href="#step-1-select-the-assets-to-monitor" id="step-1-select-the-assets-to-monitor"></a>

Every table you select here gets one monitor built from the template.

1. Narrow the list with **Filter by source** and **Filter by schema**, or search for tables by name.
2. Tick the tables you want. The counter above the list tracks your selection against the number of tables in view, and **Clear all** resets it.
3. Check the selected assets panel on the right. Newly added tables are marked, and removing a table with the **X** marks it to be removed with an undo control next to it, so you can reverse a removal before you continue.
4. Click **Next: Review**.

Freshness monitors run on tables, so the asset picker lists tables only.

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2FCHX1bx6AfAKQgngeDp0A%2FCreate%20Monitors%20-%20Step%201%20(Wide)%20(1).png?alt=media&amp;token=bccf1044-e9ab-491b-8bb3-c7bec7c5e1d3" alt=""><figcaption></figcaption></figure>

#### Step 2: Review the monitors to create <a href="#step-2-review-the-monitors-to-create" id="step-2-review-the-monitors-to-create"></a>

The review step is where you can do a final confirmation: the left panel lists one row per monitor about to be created, and selecting a row opens that monitor's own configuration on the right, pre-filled from the template.

From here you can:

* **Override any field for a single monitor.** The monitor name, schedule, detection method, and threshold are all editable per row. Everything you leave alone keeps the template's value.
* **Remove a monitor from the batch.** Use the **X** on its row. The table stays selected in your workspace, and no monitor is created for it.

Attributes are the exception. They apply to every monitor in the batch and are shown once at the top rather than per row.

A template value does not always resolve against every table you selected. The clearest case is a **Specific column** detection method whose patterns find no column on a particular table.

You have two ways forward for each flagged row: fill in the blanked field for that monitor, or remove the row from the batch and handle that table separately. Resolve every flagged row before you create the batch.

When the batch reads has no more errors to resolve, click **Create&#x20;*****N*****&#x20;monitors**.

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2FrrCJCzjFSGMpvNWBGu9B%2FCreate%20Monitors%20-%20Step%202%20(Wide)%20-%202%20Panel%20Design%20(1).png?alt=media&amp;token=93c4b800-4244-4fb1-a582-436d45faa958" alt=""><figcaption></figcaption></figure>

### Edit, duplicate, and delete a template <a href="#edit-duplicate-and-delete-a-template" id="edit-duplicate-and-delete-a-template"></a>

Manage templates from the row menu on the **Templates** tab, or from the Template Details page.

* **Edit** changes any field except the monitor type. Your changes apply to monitors you create afterwards, so editing a template is safe to do at any time.
* **Duplicate** copies the whole configuration into a new template named `<original name> (Copy)`. This is how you move a configuration to the other monitor type, and how you fork a house standard for a layer that needs one field changed.
* **Delete** removes the template. The monitors it created keep running.

Template Details also shows how many monitors the template has created and when it was last used, which is the quickest way to see whether a template is a house standard or a one-off worth deleting.

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2FpDaOOJRsJQElPQrblpOe%2FTemplate%20details%20(1).png?alt=media&amp;token=8273cf9c-f483-463c-8f23-e8ba170cb444" alt=""><figcaption></figcaption></figure>

## Frequently Asked Questions

1. Can I create Volume or Field Health monitors from a template?

Templates cover **Freshness - Staleness** and **Freshness - SLA** today. Volume and Field Health monitors are on the roadmap for templates, and the flow will work the same way once they arrive: build the template, pick your assets, review, create. Until then, create those monitor types from **Create a monitor** on the Monitors tab.

2. Does editing a template change the monitors it already created?

No. A template is a starting point rather than a live link. Monitors keep the configuration they were created with, and your edits apply to monitors you create from that template afterwards. To change monitors that already exist, use bulk update.

3. Can one template create both Staleness and SLA monitors?

No. The monitor type is fixed when you create the template. Duplicate the template and change the monitor type on the copy to cover the other one.

4. What happens if my regex pattern matches two columns on a table?

No column is selected for that table, and Decube stops working down the pattern list rather than falling through to a broader pattern. The monitor is flagged at the review step for you to resolve. Anchoring the pattern, for example `^updated_at$` rather than `updated`, avoids this.

5. Can I apply the same template to a table that already has a monitor?

Yes. Applying a template creates new monitors and leaves existing ones untouched, so check the review list if you want to avoid duplicate coverage on a table.

6. Do I have to override every flagged monitor?

You can either fill in the blanked field or remove that row from the batch. The batch cannot be created while rows are still flagged.

7. Can I undo a bulk creation?

Not as a single action. Use bulk update to change the monitors together, or delete the ones you did not want.
