> For the complete documentation index, see [llms.txt](https://docs.lenses.io/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lenses.io/latest/devx/5.5/user-guide/cli/admin/alerts.md). Agents can also search and read this documentation through its [MCP server](https://docs.lenses.io/latest/~gitbook/mcp).

# Alerts

This page describes the commands to manage Lenses Alerts via the CLI.

## View all raised alert notifications <a href="#view-all-raised-alert-notifications" id="view-all-raised-alert-notifications"></a>

Copy

```bash
lenses-cli alerts
```

## View all alert settings <a href="#view-all-alert-settings" id="view-all-alert-settings"></a>

Copy

```bash
lenses-cli alert settings
```

## View an alert setting <a href="#view-an-alert-setting" id="view-an-alert-setting"></a>

```bash
lenses-cli alert setting --id=2000
```

## Enable or disable an alert setting <a href="#enable-or-disable-an-alert-setting" id="enable-or-disable-an-alert-setting"></a>

### Enabling <a href="#enabling" id="enabling"></a>

```bash
lenses-cli alert setting --id=1000 --enable
```

### Disabling <a href="#disabling" id="disabling"></a>

```bash
lenses-cli alert setting --id=1000 --enable=false
```

## View all conditions that belong to a specific alert setting <a href="#view-all-conditions-that-belong-to-a-specific-alert-setting" id="view-all-conditions-that-belong-to-a-specific-alert-setting"></a>

```bash
lenses-cli alert setting conditions --alert=2000
```

## Create or update an existing condition for a specific alert setting <a href="#create-or-update-an-existing-condition-for-a-specific-alert-setting" id="create-or-update-an-existing-condition-for-a-specific-alert-setting"></a>

```bash
lenses-cli alert setting condition set \
--alert=2000 \
--condition="lag >= 200000 on group groupA and topic topicA" \
--channels="f9d6140c-4823-4157-a93c-5147aa0e2f29"

# For "Data Produced" type of alert rules
lenses-cli alert setting condition set \
    --alert=5000 \
    --topic=my-topic \
    --duration=PT6H \
    --more-than=5

# optional channels can be used more than once
# You can get the ID of a channel with `lenses-cli alertchannels`
lenses-cli alert setting condition set \
    --alert=5000 \
    --topic=my-topic \
    --duration=PT6H \
    --more-than=5 \
    --channels="9176c428-be0e-4c36-aa1e-8b8a66782232" \
    --channels="7b184b13-f37c-4eee-9c0a-17dec2fd7bf5"
```

## Update an existing condition using flags <a href="#update-an-existing-condition-using-flags" id="update-an-existing-condition-using-flags"></a>

```bash
lenses-cli alert setting condition set --alert 2000 \
    --condition="lag >= 95 on group group-1 and topic topic-1" \
    --conditionID="5a6c3951-dfde-478e-8952-8193e62a9a8a" \
    --channels="143315dd-80bf-4833-a13a-394be06dda87" \
    --channels="f9d6140c-4823-4157-a93c-5147aa0e2f29"

# For "Data Produced" type of alert rules
# update - identify rule to update by its condition ID
lenses-cli alert settings --query="categories.producers" | jq .

lenses-cli alert setting condition set \
    --conditionID=f4a623e3-5287-4ca3-9d05-8f0ab68a9b4b \
    --alert=5000 \
    --topic=my-topic \
    --duration=PT6H \
    --more-than=5
```

## Create or update a condition from a file <a href="#create-or-update-a-condition-from-a-file" id="create-or-update-a-condition-from-a-file"></a>

```bash
cat > alert_cond.yaml <<- "EOF"
alert: 2000
conditionID: "5a6c3951-dfde-478e-8952-8193e62a9a8a"
condition:
  "lag >= 30 on group schema-registry and topic backblaze_smart"
channels:
  - "143315dd-80bf-4833-a13a-394be06dda87"
  - "f9d6140c-4823-4157-a93c-5147aa0e2f29"
EOF

lenses-cli alert setting condition set alert_cond.yaml

# For "Data Produced" type of alert rules
cat > data_produced_alert.yaml <<- "EOF"
topic: "my-yaml-topic"
alert: 5000
more-than: 6990
duration: "PT6H"
EOF

lenses-cli alert setting condition set data_produced_alert.yml
```

{% hint style="info" %}
Command line flags are ignored when loading from files.
{% endhint %}

## Delete an existing condition for a specific alert

```bash
lenses-cli alert setting condition delete \
    --alert=2000 \
    --condition="7643d1ec-73f9-4913-95d1-87e62f1ec172"

# For "Data Produced" type of alert rules
alert setting condition delete \
    --alert 5000 \
    --condition=19e7791d-9fbf-4b6b-b198-8490e5e30d29
```

{% hint style="info" %}
The value of the \`--alert\` flag is the Alert ID that the alert setting belongs to whereas the value of the \`--condition\` flag is the UUID of the condition to delete.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lenses.io/latest/devx/5.5/user-guide/cli/admin/alerts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
