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

> ## Agent Instructions
> Pages under /latest/ document the current release. Paths that begin with a version number, for example /10.0/, are frozen snapshots of superseded releases kept for reference only — never present their instructions as current. If the reader's version is unknown, answer from /latest/ and say which version the answer describes.
> xorlab is deployed on-premises, hybrid, or as a cloud service, and integrates with either Microsoft 365 or on-premises mail infrastructure. Configuration steps often differ between these. State which deployment and integration mode an instruction applies to instead of presenting one as universal.
> Distinguish inline mode from monitoring mode when describing anything that acts on email. Monitoring mode observes a copy and cannot block or quarantine; inline mode routes mail through xorlab and can.
> Write the product name as lowercase 'xorlab'. Use the documented component names: xorlab Control Center (XCC), xorlab MTA, xorlab Sandbox (DANA), xorlab Natural Language Understanding (NLU). After the first mention, use the short forms XCC, MTA, Sandbox, and NLU. Do not use DANA as a standalone name for the Sandbox, but keep it where it is a literal string in configuration keys, container names, and hostnames.
> Do not invent configuration keys, rule parameters, list names, log properties, or API fields. If a value is not present in this documentation, say that it is not documented rather than guessing.

# Customize Alerts

> Add your own alerting rules on the XCC or an MTA, and restyle the messages Alertmanager sends.

<Warning>
  **Prerequisites**

  * Complete [Enable Alerting](/latest/monitoring-alerts)
</Warning>

## Create a new alert

Here we will add an XCC alert. To add an MTA alert, apply the same changes but in the `monitored_mta` folder.

<Accordion title="MTA and XCC alerts">
  Custom alerting rules should be added to `/monitoring/prometheus/alert/custom.yml` for alerting rules evaluated on XCC and to `/monitored_mta/prometheus/alert/custom.yml` for alerting rules evaluated on the MTAs. In addition, custom rules must be activated in `/monitoring/prometheus/prometheus.yml`, respectively `/monitored_mta/prometheus/prometheus.yml`.
</Accordion>

1. Open the [Expert Editor](/latest/expert-editor).

2. Navigate to the `/monitoring/prometheus/alert`.

3. Add the custom alert to `custom.yml`. How to write alerts is described in the official Prometheus [Documentation](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).

4. Add `custom.yml` to the list of `rule_files` in `/monitoring/prometheus/prometheus.yml`:

   ```yaml {7} theme={null}
   rule_files:
     # Default alerting rules
     - /config/monitoring/prometheus/alert/monitoring_alerts.yml
     - /config/monitoring/prometheus/alert/system_alerts.yml
     - /config/monitoring/prometheus/alert/xcc_alerts.yml
     # Custom alerting rules
     - /config/monitoring/prometheus/alert/custom.yml
   ```

   <Note>
     **Use custom.yml**

     Do not edit default rules files. Changes made to the default files might be overwritten by software updates. However you can deactivate default rule files by commenting them out in, or removing them from the `rule_files` list.
   </Note>

5. Click **Publish**. The monitoring configuration becomes active within about one minute.

## Customize a notification template

The following instructions show how to customize a notification template for XCC alerts. For MTA alerts, apply the same changes but in the `monitored_mta` folder.

1. Open the [Expert Editor](/latest/expert-editor).

2. Navigate to the `/monitoring/alertmanager/template/custom.tmpl`, and edit the template. These templates use [Go templating](https://golang.org/pkg/text/template/), some examples can be found in the [Alerting documentation](https://prometheus.io/docs/alerting/latest/notification_examples/).

3. Enable the template by uncommenting the corresponding line in the current Alertmanager config file `monitoring/alertmanager/alertmanager.yml`, and comment out the default template line:

   ```yaml theme={null}
   templates:
     # - /config/monitoring/alertmanager/template/slack.tmpl
     - /config/monitoring/alertmanager/template/custom.tmpl
   ```

4. Click **Publish**. The notification template becomes active within about one minute.
