Alerts


The CLI can view all available alert notifications or modify and delete alert settings.

View all raised alert notifications 

lenses-cli alerts

View all alert settings 

lenses-cli alert settings

View an alert setting 

lenses-cli alert setting --id=2000

Enable or disable an alert setting 

Enabling 

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

Disabling 

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

View all conditions that belong to a specific alert setting 

lenses-cli alert setting conditions --alert=2000

Create or update an existing condition for a specific alert setting 

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 

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 

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

Delete an existing condition for a specific alert 

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

--
Last modified: April 17, 2024