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

# Use monitors to generate alerts and notifications

> Create and manage monitors that generate alerts and notifications from your data, and compare thresholds against historical data.

Use Palo Alto Networks Cortex XCOR alerting to generate alerts and notifications
from your data, whether it's about your system or about your usage of Cortex XCOR
itself. Compare your monitor configurations to historical data to ensure your
thresholds meet your needs.

> [!NOTE]
>
> Prefer a guided lab? Take [Creating and Tuning Monitors](https://docs-xcor.paloaltonetworks.com/academy/courses/creating-and-tuning-monitors.md) to build monitor queries,
> signals, notification templates, and conditions step by step.

Cortex XCOR lets you designate certain monitors as your
[favorites](https://docs-xcor.paloaltonetworks.com/navigate/favorites.md), listing them on your personal home page and
prioritizing them in global search results.

Cortex XCOR provides
[generative artificial intelligence](https://docs-xcor.paloaltonetworks.com/overview/generative-ai.md) (AI) tools that help
you work with monitors:

* Generate a monitor's query from a natural language prompt by clicking
  **Edit with AI** in the query field. See
  [Generate queries for monitors](https://docs-xcor.paloaltonetworks.com/investigate/querying/natural-language.md#generate-queries-for-monitors).
* Ask [Operator](https://docs-xcor.paloaltonetworks.com/navigate/operator) to explain a monitor's configuration,
  including what triggers it and who it notifies. Click
  ** Ask Operator** in the page header or press <kbd>A</kbd>.

> [!WARNING]
>
> Generative AI features can produce incorrect results, hallucinate data, and deliver
> inaccurate analysis. Use generative AI features with care, and independently verify
> all information produced by generative AI tools before applying it.
>
> Certain prompts, data, or other inputs might produce irrelevant content. Don't rely on
> generative AI features or responses for any uses that exceed their designed scope.

## View available monitors

Select from the following methods to view and filter monitors.

To query and get detailed information about monitors, see
[monitor actions](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/monitor-actions.md).

> [tab] Web
>
> To display a list of defined monitors, in the navigation menu, select
> \*\* Alerting > Monitors\*\*.
>
> The list of monitors includes an **Alert state** column. Each monitor displays a
> badge showing the icon for its most severe active state, with a text label listing
> all active alert counts. For example, a monitor with two active critical alerts and
> one active warning alert shows the critical icon with the label **2 Critical, 1 Warning**.
>
> | Icon | State | Description |
> | - | - | - |
> | | **Critical** | Monitor has at least one active critical alert. |
> | | **Warning** | Monitor has at least one active warning alert, and no critical alerts. |
> | ![Muted bell icon](https://mintcdn.com/chronosphere-74b1ef6e/DtNkYHISkABv3IpM/public/doc-assets/bell-snooze.svg?fit=max\&auto=format\&n=DtNkYHISkABv3IpM\&q=85\&s=5995729feb8e8cff6432f2330a7b9cb3) | **Muted** | Monitor's alerts are muted. |
> | | **Passing** | Monitor has no active alerts. |
>
> Use the following methods to filter your monitors:
>
> * Using the **Search monitors** search box (an **OR** filter).
> * By team, using the **Select a team** dropdown.
> * By owner, using the **Select an owner** dropdown. The CollectionIcon icon
>   indicates the monitor is part of a [collection](https://docs-xcor.paloaltonetworks.com/administer/collections). The
>   ServiceIcon icon indicates this monitor is part of a service.
> * By notification policy, using the **Select a notification policy** dropdown.
> * By error status:
>   * **All**: Default, displays all monitors.
>   * **Alerting**: Monitors currently in alert status.
>   * **Critical**: Monitors in a critical alert status.
>   * **Muted**: Displays only muted monitors.
> * To filter the table to display only your favorite monitors, enable the
>   **View only my favorites** toggle.
> * **Include connected monitors**: If you filter monitors by owner with the
>   toggle disabled, only monitors owned by that owner are returned. When the toggle
>   is enabled, your filter includes monitors that are connected to that owner, even
>   if they aren't owned by that owner. Connections are based on
>   [collections](https://docs-xcor.paloaltonetworks.com/administer/collections/home.md).
>
> Monitors with defined signals display the  file
> tree icon. To view the signals from a displayed monitor, click the name of the
> monitor from the list.
>
> From a monitor's detail page, click the name of a signal from the **Signals** section
> to filter the query results to alerts only from that signal.
>
> To search for a specific monitor:
>
> 1. Click the search bar to focus on it, or use the keyboard shortcut
>    `Control+K` (`Command+K` on macOS).
> 2. Begin typing any part of the monitor's name.
> 3. Optional: Click the filters for all other listed resource types at the top of the
>    search results to remove them and display only monitors.
> 4. Click the search result you're interested in, or use the arrow keys to select it
>    and press enter, to go to that monitor.

> [tab] Chronoctl
>
> To use [Chronoctl](https://docs-xcor.paloaltonetworks.com/tooling/chronoctl) to return all monitors, use the
> `chronoctl monitors list` command:
>
> ```shell theme={null}
> chronoctl monitors list
> ```
>
> To filter for a specific monitor, add the `slugs` argument to the command:
>
> ```shell /SLUG/ theme={null}
> chronoctl monitors list --slugs SLUG
> ```
>
> Replace *`SLUG`* with the slug for the monitor you want to
> display.
>
> To search for monitors by partial name instead of an exact slug, add the
> `--name-contains` argument. This match isn't case sensitive and returns every monitor
> whose name contains the provided string:
>
> ```shell /STRING/ theme={null}
> chronoctl monitors list --name-contains STRING
> ```
>
> Replace *`STRING`* with the text to match against monitor names. For example,
> `chronoctl monitors list --name-contains payment` returns monitors named `Payment API`
> and `Checkout payment`. The `--name-contains` flag requires Chronoctl v0.86.0 or later.
>
> [Use the Code Config tool](https://docs-xcor.paloaltonetworks.com/tooling/gitops.md#use-the-code-config-tool) in Cortex XCOR to
> view the monitor's Chronoctl YAML representation.

> [tab] Terraform
>
> [Use the Code Config tool](https://docs-xcor.paloaltonetworks.com/tooling/gitops.md#use-the-code-config-tool) in Cortex XCOR to
> view a monitor's Terraform representation.

> [tab] API
>
> To complete this action with the Cortex XCOR API, use the
> [`ListMonitors`](https://docs-xcor.paloaltonetworks.com/tooling/api-info/definition/operations/ListMonitors) endpoint.
>
> To filter the monitors that `ListMonitors` returns, use one or more of these query
> parameters:
>
> * `names`: Returns only monitors whose name exactly matches a name in the provided
>   list.
> * `name_contains`: Returns only monitors whose name contains the provided string.
>   This match isn't case sensitive, so you can search for monitors by partial name
>   without knowing their exact names. For example, `name_contains=payment` returns
>   monitors named `Payment API` and `Checkout payment`.
> * `slugs`, `bucket_slugs`, `collection_slugs`, and `team_slugs`: Returns only
>   monitors that match the provided slugs.
>
> For example, to return every monitor whose name contains `payment`:
>
> ```shell wrap theme={null}
> curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
>      "https://${CHRONOSPHERE_DOMAIN}/api/v1/config/monitors?name_contains=payment"
> ```
>
> Because the Cortex XCOR API requires authentication, include an API token with your
> `curl` request, as shown in the following example. For more details, see
> [Create an API token](https://docs-xcor.paloaltonetworks.com/tooling/api-info.md#create-an-api-token).
>
> ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null}
> export CHRONOSPHERE_API_TOKEN="TOKEN"
> export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"
>
> curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
>      -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
> ```
>
> Replace the following:
>
> * *`TOKEN`*: Your API token.
> * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance.
> * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`.
> * *`ENDPOINT_PATH`*: The specific endpoint you want to access.

For information about what's available on an individual monitor's detail page, including
query results, series legend, active alerts, alert history, and change events, see
[Monitor details](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/monitor-details.md).

## Create a monitor

Most monitors alert when a value matches a specific condition, such as when an error
condition defined by the query lasts longer than one minute.

You can also choose to alert when a value doesn't exist, such as when a host stops
sending metrics and is likely unavailable. The **Web** procedure in
[Create monitors](#create-monitors) walks through missing data using **not exists** and
**signal not exists** in **Conditions**. For how those choices map to configuration,
signal grouping, and Prometheus, logs, or Graphite support, see
[Missing data conditions](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#missing-data-conditions).

To receive alerts when a host stops sending metrics, create a separate monitor for
each host and scope the monitor query to that host.

### Prerequisites

Before creating a monitor, complete the following tasks:

1. Create a [notifier](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/notifiers) to define where to deliver
   alerts and who to notify.
2. Create a [notification policy](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/policies.md) to determine how to
   route notifications to notifiers based on signals that trigger from your monitor.
   You select the notifier you created for the critical or warning conditions on the
   notification policy.

### Create monitors

After completing the [prerequisite tasks](#prerequisites), use any of the following
methods to create a new monitor.

While creating or editing a monitor, simulate alerts to backtest your conditions against
historical data and see how the alert would have performed.

> [!NOTE]
>
> Cortex XCOR recommends a minimum query interval of 15 seconds. There can be
> a 10-second delay between an alert trigger and the notifier activation.

Use one of the following procedures to create a monitor.

> [tab] Web
>
> To add a new monitor:
>
> 1. In the navigation menu, select one of these locations:
>    * \*\* Alerting > Monitors\*\*.
>    * **Platform > Collections**,
>      and then select the collection you want to create a monitor for. This can be a
>      standard collection or a [service](https://docs-xcor.paloaltonetworks.com/observe/services).
>
> 2. Create the monitor:
>    * From the **Monitors** page, click **Create monitor** to open the **Add Monitor**
>      panel.
>    * To create a monitor by duplicating an existing monitor, click the monitor on
>      the **Monitors** page, then click \*\* Duplicate\*\*
>      to open the **Duplicate monitor** panel.
>    * From the **Collections** page, in the **Monitors** panel, click **Manage**,
>      then click **New monitor**.
>
> 3. Enter the information for the monitor based on its [data model](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md).
>
> 4. Select an **Owner** to organize and filter your monitor. You can select a
>    collection or a service.
>
> 5. Enter a **Monitor Name**, which you can change after creating the monitor. Monitor
>    names are static strings and don't accept label variables, such as `$labels.LABEL_NAME`.
>
> 6. Choose a **Notification Policy** to determine which notification policy to use
>    at a particular alert severity.
>
> 7. Enter **Labels** as key-value pairs to categorize and filter monitors.
>
> 8. In the **Query** section, choose the type of query you want to enter:
>
>    * **Prometheus**: Enter a valid Prometheus query. Click **Edit in Query Builder**
>      to open your query in the [Query Builder](https://docs-xcor.paloaltonetworks.com/investigate/querying/metrics/builder.md), where
>      you can construct, optimize, and debug your query before saving it. After
>      modifying your query, click **Done** to return to the **Add Monitor** page.
>    * **Graphite**: Enter a valid Graphite query.
>    * **Logs**: Enter a valid log query, which must include the
>      [`make-series`](https://docs-xcor.paloaltonetworks.com/investigate/querying/query-logs/query-syntax#make-series)
>      operator with a specified `step` size to return data. This operator uses the
>      [`count()`](https://docs-xcor.paloaltonetworks.com/investigate/querying/query-logs/query-syntax#count) function by
>      default, but you can specify different operators instead.
>
>      For example, the following query creates a time chart that includes the average for
>      `latencyInSeconds`. The `step` parameter defines the time step for each bucket in
>      [Prometheus time duration format](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-durations):
>
>      ```text theme={null}
>      severity = "WARNING"
>      | make-series avg(latencyInSeconds) step 15m by severity, service
>      ```
>
>      > [!NOTE]
>      >
>      > If the log query includes a field that contains a period in its name and you
>      > want to use signals to group notifications, use an
>      > [alias for that field name](https://docs-xcor.paloaltonetworks.com/investigate/querying/query-logs/query-syntax.md#alias-field-names).
>      > Otherwise, periods are converted to underscores in the generated visualization.
>
> 9. Use these options to validate and update your query:
>
>    * Click **Check Query** to validate your query and preview query results. In the
>      query preview, use the following options to understand your query:
>
>      * Toggle **Show thresholds** to display the monitor's defined thresholds.
>      * Select a time range up to the present in the
>        \*\* [time range selector](https://docs-xcor.paloaltonetworks.com/navigate/time-ranges.md)\*\*.
>
>        If your selected time period has too many alerts, or the entire graph appears
>        to display in alerted status, reduce the selected time period. If multiple
>        alerts would have triggered simultaneously, only one threshold marker displays.
>        The banner shows the correct number of alerts. For example, if a critical and
>        a warning would trigger at the same time, only one alert displays on the graph.
>        The banner shows two alerts would have triggered.
>    * Click **Open in Explorer** to open your query in
>      [Metrics Explorer](https://docs-xcor.paloaltonetworks.com/investigate/querying/metrics/explorer.md), where you can review
>      your query for syntax errors and make necessary changes.
>
> 10. For Prometheus queries, test monitor conditions by reviewing when a monitor would
>     have triggered, based on historical data. The preview reflects existing monitor
>     schedules, signal grouping, and overrides:
>
>     * Use the **Show alert durations** toggle to display the time period over which
>       the alert would have been active.
>     * Toggle **Simulate alerts** to backtest your condition against existing data. You
>       must define at least one condition for alert simulations to work.
>
>       > [!NOTE]
>       >
>       > Alert simulations use existing data, and can't predict future alerts.
>
>       If your selected query returns too much data, the graph displays an error.
>       Cortex XCOR recommends selecting shorter time periods for testing, when possible.
>       Alert simulation isn't available outside the
>       [raw data retention period](https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/licensing.md#ingestion-limits-and-retention-policies).
>
> 11. Optional: Group alerts based on the results returned from the query by choosing an
>     option in the **Signals** section.
>     [Signals](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/signals.md) use a unique set of labels to
>     create groups of notifications when a monitor alert triggers or resolves.
>
>     > [!NOTE]
>     >
>     > If you select **per signal (multiple alerts)** to generate multiple alerts, enter
>     > a label key that differs in name and casing from the label you enter in the
>     > **Key** field in the **Labels** section. For example, if you enter `environment`
>     > in the **Key** field, you might use `Environments` as the **Label Key** to match
>     > on.
>
> 12. Define a condition and sustain period in the **Conditions**
>     section, and assign the resulting alert a severity (warning or critical). In
>     the **Sustain** field, enter a value followed by an abbreviated unit such as
>     `60s`. Valid units are `s` (seconds), `m` (minutes), `h` (hours), or `d`
>     (days). The dialog also displays the notifiers associated with the monitor for
>     reference.
>
>     > [!NOTE]
>     >
>     > To generate an alert when the entire monitor query returns no results, select
>     > **not exists** in the **Alert when value** dropdown. Select **signal not exists**
>     > when alerts should respect
>     > [signal grouping](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/signals.md). For example, all
>     > series in a signal must be missing, or any single series when using per-series
>     > signals. The **signal not exists** option requires a sustain duration between
>     > 5 minutes and 24 hours.
>
> 13. The fields for defining resolution time depend on the comparison selector you choose.
>
>     For **Resolve when clear for**, enter a time period for the resolve window in the
>     **Resolve** field as a value followed by an abbreviated unit such as `30s`. Valid units are
>     `s` (seconds), `m` (minutes), `h` (hours), or `d` (days).
>
>     When **Alert when value** uses one of these comparisons: greater than `>`,
>     greater than or equal to `>=`, less than `<`, or less than or equal to `<=`, set a
>     **Resolve threshold**.
>
>     1. Click **Add threshold**.
>     2. Enter a **Resolve value**. The alert doesn't clear until the series
>        crosses that separate boundary. If you omit this section, resolution uses the
>        same threshold as the trigger. See
>        [Resolve threshold](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#resolve-threshold).
>
> 14. In the **Monitor schedule** section, choose when Cortex XCOR
>     evaluates the monitor and can send alerts:
>
>     * **Always on**: The monitor is evaluated continuously and can alert whenever
>       conditions are met. This is the default behavior when you don't restrict
>       evaluation windows.
>     * **Scheduled**: The monitor is evaluated only during the time windows you
>       define.
>
>       1. Select **Time zone** for the schedule.
>       2. For each time window, set **Start** and **End** using 24-hour times in
>          `HH:MM` form.
>       3. Under **Repeat every**, select the days of the week that window applies to.
>       4. Use **Add range** to add more than one weekly window.
>     * **Disabled**: The monitor doesn't send alerts. Use this mode to keep the monitor
>       definition without active alerting.
>
>     For schedule behavior, alerting, resolution, and end times, for example `24:00`
>     instead of `23:59`, see
>     [Schedule](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#schedule) in the monitor data
>     model.
>
> 15. Add notes for the monitor in the **Annotations** section, such as runbook
>     summaries and descriptions.
>
> 16. Optional: In the **Links** section, add
>     [templated links](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/annotation-links.md) to dashboards,
>     Logs Explorer, and external runbooks.
>
> 17. Optional: In the **Notification Template** section, set a **Title** and
>     **Description** to customize the notifications this monitor generates. Both
>     fields support Go templating with alert context. See
>     [notification templates](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/notification-templates.md).
>
> 18. Click **Save**.

> [tab] Chronoctl
>
> To create a monitor with [Chronoctl](https://docs-xcor.paloaltonetworks.com/tooling/chronoctl):
>
> 1. Run the following command to generate a sample monitor configuration you can use
>    as a template:
>
>    ```shell theme={null}
>    chronoctl monitors scaffold
>    ```
>
>    In the template, `kind: Monitor` defines an individual monitor.
>
> 2. With a completed definition, submit it with:
>
>    ```shell /FILE_NAME/ theme={null}
>    chronoctl monitors create -f FILE_NAME
>    ```
>
>    Replace *`FILE_NAME`* with the name of the YAML definition file you want to use.
>
> See the
> [Chronoctl examples](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#chronoctl-example-prometheus)
> for a completed monitor definition.

> [tab] Terraform
>
> > [!NOTE]
> >
> > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically
> > tests configurations that include notification policies by submitting them as dry runs.
> > For details, see the
> > [Terraform provider](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform#validate-plans-with-dry-runs)
> > documentation.
>
> To create a monitor with [Terraform](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform):
>
> 1. Create or edit a Terraform file and add the definition by using the
>    `chronosphere_monitor` type, followed by a name in a resource declaration.
>
> 2. Run this command to apply the changes:
>
>    ```shell theme={null}
>    terraform apply
>    ```
>
> See the
> [Terraform examples](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#terraform-example-prometheus)
> for a completed monitor resource.

> [tab] API
>
> To complete this action with the Cortex XCOR API, use the
> [`CreateMonitor`](https://docs-xcor.paloaltonetworks.com/tooling/api-info/definition/operations/CreateMonitor) endpoint.
>
> Because the Cortex XCOR API requires authentication, include an API token with your
> `curl` request, as shown in the following example. For more details, see
> [Create an API token](https://docs-xcor.paloaltonetworks.com/tooling/api-info.md#create-an-api-token).
>
> ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null}
> export CHRONOSPHERE_API_TOKEN="TOKEN"
> export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"
>
> curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
>      -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
> ```
>
> Replace the following:
>
> * *`TOKEN`*: Your API token.
> * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance.
> * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`.
> * *`ENDPOINT_PATH`*: The specific endpoint you want to access.

For complete monitor definitions in Chronoctl and Terraform that cover both
Prometheus and logs queries, see
[Configuration examples](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#configuration-examples)
in the monitor data model.

## Edit a monitor

Select from the following methods to edit monitors.

> [!NOTE]
>
> Users can modify Terraform-managed resources only by using Terraform.
> [Learn more](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform#prevent-changes-to-managed-resources).

> [tab] Web
>
> To edit a monitor:
>
> When editing a monitor, use the same interface as when you created it.
>
> 1. In the navigation menu, select
>    \*\* Alerting > Monitors\*\*.
> 2. Click the name of the monitor you want to edit.
> 3. On the monitor's page, click \*\* Edit\*\* in the page header.
>    The **Edit monitor** drawer opens with the same fields as when you create a monitor.
> 4. Make your edits, and then click **Save**. Refer to the
>    [monitor data model](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md) for specific definitions.

> [tab] Chronoctl
>
> To edit a monitor using [Chronoctl](https://docs-xcor.paloaltonetworks.com/tooling/chronoctl):
>
> 1. [View the monitor's Chronoctl YAML](#view-available-monitors).
> 2. Modify its properties and apply the changes with the same process as
>    [creating a monitor](#create-a-monitor). Chronoctl updates the monitor's
>    properties if the definition has the same slug.
>
> You can also use the following process if you already have a definition file:
>
> 1. Update the monitor's definition file.
> 2. Run the following command to submit the changes:
>
>    ```shell /FILE_NAME/ theme={null}
>    chronoctl monitors update -f FILE_NAME
>    ```
>
>    Replace *`FILE_NAME`* with the name of the YAML definition file you want to use.
>
> You can also use the Code Config tool to view the monitor's Chronoctl YAML
> representation. For details, see
> [Use the Code Config tool](https://docs-xcor.paloaltonetworks.com/tooling/gitops.md#use-the-code-config-tool).

> [tab] Terraform
>
> To edit a monitor using [Terraform](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform):
>
> 1. Create or edit a Terraform file that updates the resource's existing properties.
> 2. Run this command to apply the changes:
>
>    ```shell theme={null}
>    terraform apply
>    ```
>
> You can also use the Code Config tool to view the monitor's Terraform representation.
> For details, see [Use the Code Config tool](https://docs-xcor.paloaltonetworks.com/tooling/gitops.md#use-the-code-config-tool).

> [tab] API
>
> To complete this action with the Cortex XCOR API, use the
> [`UpdateMonitor`](https://docs-xcor.paloaltonetworks.com/tooling/api-info/definition/operations/UpdateMonitor) endpoint.
>
> Because the Cortex XCOR API requires authentication, include an API token with your
> `curl` request, as shown in the following example. For more details, see
> [Create an API token](https://docs-xcor.paloaltonetworks.com/tooling/api-info.md#create-an-api-token).
>
> ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null}
> export CHRONOSPHERE_API_TOKEN="TOKEN"
> export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"
>
> curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
>      -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
> ```
>
> Replace the following:
>
> * *`TOKEN`*: Your API token.
> * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance.
> * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`.
> * *`ENDPOINT_PATH`*: The specific endpoint you want to access.

### Override a monitor alert

You can override the default conditions that define when an alert triggers for a
monitor. This override is similar to
[overriding a notification policy](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/policies.md#override-notification-policy-defaults)
that routes a notification to a notifier other than the specified default.

On a monitor, you can specify a condition override to use a separate threshold for
certain series. For example, a monitor might have a default threshold of `>100` but
you specify an override threshold of `>50` where the label key-value pair is
`cluster=production`.

You can specify any label as a matcher for a monitor condition override. If no
override matches the defined conditions, Cortex XCOR applies the default
conditions. Additionally:

* Overrides must specify at least one matcher, and meet every matcher condition to
  apply the override.
* Cortex XCOR evaluates overrides in the listed order. When an override
  matches, the remaining overrides and defaults are ignored.
* Overrides don't inherit any properties from the default conditions. For example, if
  the default policy route specifies `warn` and `critical` notifiers but the override
  specifies only `critical` notifiers, the notifier doesn't send `warn`
  notifications.
* You can't use `NOT_EXISTS` or `SIGNAL_NOT_EXISTS` on override conditions; use them
  only on default conditions.

> [!NOTE]
>
> Users can modify Terraform-managed resources only by using Terraform.
> [Learn more](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform#prevent-changes-to-managed-resources).

To specify a monitor alert override:

> [tab] Web
>
> 1. In the navigation menu, select
>    \*\* Alerting > Monitors\*\*.
> 2. Click the name of the monitor you want to specify an override for.
> 3. On the monitor's page, click \*\* Edit\*\* in the page header.
>    The **Edit monitor** drawer opens.
> 4. In the **Condition Override** section, click the plus icon&#x20;
>    to display the override fields.
> 5. Select **Exact** or **Regex** as the matcher type, and enter the key-value pair
>    to match on for the override.
> 6. Select **Critical** or **Warn** as the override severity.
> 7. Define the match condition and sustain duration.
> 8. Optional: Set a **Resolve threshold** using the same rules as
>    [default conditions](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/data-model.md#resolve-threshold).
> 9. Click **Save** to apply the override changes.

> [tab] Terraform
>
> 1. Use [Terraform](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform) to add an override
>    to the resource's existing properties and apply the changes.
> 2. Run this command to apply the changes:
>
>    ```shell theme={null}
>    terraform apply
>    ```
>
> The following Terraform HCL definition adds monitor overrides that match on specific labels,
> and associate either a `warn` or `critical` alert based on the matching key-value
> pairs.
>
> ```terraform expandable theme={null}
> series_conditions {
>   condition {
>     severity = "critical"
>     op       = "GT"
>     value    = 20
>     sustain  = "180s"
>     resolve_sustain = "180s"
>   }
>
>   condition {
>     severity = "warn"
>     op       = "GT"
>     value    = 10
>     sustain  = "180s"
>   }
>
>   override {
>     label_matcher {
>       type  = "EXACT_MATCHER_TYPE"
>       name  = "namespace"
>       value = "production"
>     }
>
>     label_matcher {
>       type  = "EXACT_MATCHER_TYPE"
>       name  = "container"
>       value = "k8s_prod"
>     }
>
>     condition {
>       severity = "critical"
>       op       = "GT"
>       value    = 50
>       sustain  = "180s"
>     }
>
>     condition {
>       severity = "warn"
>       op       = "GT"
>       value    = 40
>       sustain  = "180s"
>     }
>   }
>
>   override {
>     label_matcher {
>       type  = "EXACT_MATCHER_TYPE"
>       name  = "container"
>       value = "billing_svc"
>     }
>
>     condition {
>       severity = "critical"
>       op       = "GT"
>       value    = 30
>     }
>
>     condition {
>       # only one of these conditions needs to be met
>       severity = "critical"
>       op       = "GT"
>       value    = 25
>       sustain  = "360s"
>     }
>   }
> }
> ```
>
> Based on the previous override, the following descriptions explain how incoming
> series impact alerting conditions for the monitor:
>
> * The following series doesn't match any override conditions, so the default alert
>   conditions apply:
>
>   ```text theme={null}
>   {namespace="production", container="gateway", job="gateway-scraper"} 5
>   ```
>
> * The following series matches the `warn` condition for the first override, so the
>   alert uses a `warn` notifier:
>
>   ```text theme={null}
>   {namespace="production", container="k8s_prod", job="gateway-scraper"} 45
>   ```
>
> * The following series matches the `critical` condition defined in the override, so the
>   alert uses a `critical` notifier:
>
>   ```text theme={null}
>   {namespace="foo3", container="bar", job="gateway-scraper"} 27
>   ```

## Delete a monitor

Select from the following methods to delete monitors.

> [!NOTE]
>
> Users can modify Terraform-managed resources only by using Terraform.
> [Learn more](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform#prevent-changes-to-managed-resources).

> [tab] Web
>
> To delete a monitor:
>
> 1. In the navigation menu, select
>    \*\* Alerting > Monitors\*\*.
> 2. Click the name of the monitor you want to delete.
> 3. On the monitor's page, click \*\* Edit\*\* in the page header.
>    The **Edit monitor** drawer opens.
> 4. In the drawer footer, click **Delete monitor**.
> 5. In the confirmation dialog, click **Delete**.

> [tab] Chronoctl
>
> To delete a monitor with [Chronoctl](https://docs-xcor.paloaltonetworks.com/tooling/chronoctl), use the `chronoctl monitors delete`
> command:
>
> ```shell /SLUG/ theme={null}
> chronoctl monitors delete SLUG
> ```
>
> Replace *`SLUG`* with the slug of the monitor you want to delete.
>
> For example, to delete a monitor with the slug `infra-example-monitor`:
>
> ```shell theme={null}
> chronoctl monitors delete infra-example-monitor
> ```

> [tab] Terraform
>
> To delete a resource that's managed by [Terraform](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform):
>
> 1. Edit your Terraform configuration file to remove the pre-existing resource
>    definition.
> 2. Run this command to remove the resource from Cortex XCOR:
>
>    ```shell theme={null}
>    terraform apply
>    ```

> [tab] API
>
> To complete this action with the Cortex XCOR API, use the
> [`DeleteMonitor`](https://docs-xcor.paloaltonetworks.com/tooling/api-info/definition/operations/DeleteMonitor) endpoint.
>
> Because the Cortex XCOR API requires authentication, include an API token with your
> `curl` request, as shown in the following example. For more details, see
> [Create an API token](https://docs-xcor.paloaltonetworks.com/tooling/api-info.md#create-an-api-token).
>
> ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null}
> export CHRONOSPHERE_API_TOKEN="TOKEN"
> export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"
>
> curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
>      -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
> ```
>
> Replace the following:
>
> * *`TOKEN`*: Your API token.
> * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance.
> * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`.
> * *`ENDPOINT_PATH`*: The specific endpoint you want to access.

## Annotations

Annotations provide runbook summaries, descriptions, and other text context for
on-call engineers diagnosing issues. You can template annotation values with
alerting variables such as `{{ $labels.LABEL }}` and `{{ $value }}`, and add
[templated links](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/annotation-links.md) to dashboards,
Logs Explorer, and external runbooks.

For the full list of variables, Markdown formatting, and procedures to add
annotations in the app, Chronoctl, Terraform, and the Cortex XCOR API, see
[Use annotations with monitors](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/monitor-annotations.md).


## Related topics

- [Alert notifications](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications.md)
- [Customize monitor notification messages](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/notification-templates.md)
- [Use annotations with monitors](https://docs-xcor.paloaltonetworks.com/investigate/alerts/monitors/monitor-annotations.md)
- [Overview of alerting](https://docs-xcor.paloaltonetworks.com/investigate/alerts.md)
- [Notification policies](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/policies.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.