This page describes the commands to manage Lenses Alerts via the CLI.
View all raised alert notifications
Copy
View all alert settings
Copy
View an alert setting
Enable or disable an alert setting
Enabling
Disabling
View all conditions that belong to a specific alert setting
Create or update an existing condition for a specific alert setting
Update an existing condition using flags
Create or update a condition from a file
Command line flags are ignored when loading from files.
Delete an existing condition for a specific alert
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.
lenses-clialerts
lenses-clialertsettings
lenses-clialertsetting--id=2000
lenses-clialertsetting--id=1000--enable
lenses-clialertsetting--id=1000--enable=false
lenses-clialertsettingconditions--alert=2000
lenses-clialertsettingconditionset \--alert=2000 \--condition="lag >= 200000 on group groupA and topic topicA" \--channels="f9d6140c-4823-4157-a93c-5147aa0e2f29"# For "Data Produced" type of alert ruleslenses-clialertsettingconditionset \--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-clialertsettingconditionset \--alert=5000 \--topic=my-topic \--duration=PT6H \--more-than=5 \--channels="9176c428-be0e-4c36-aa1e-8b8a66782232" \--channels="7b184b13-f37c-4eee-9c0a-17dec2fd7bf5"
lenses-clialertsettingconditionset--alert2000 \--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 IDlenses-clialertsettings--query="categories.producers"|jq.lenses-clialertsettingconditionset \--conditionID=f4a623e3-5287-4ca3-9d05-8f0ab68a9b4b \--alert=5000 \--topic=my-topic \--duration=PT6H \--more-than=5
cat>alert_cond.yaml<<-"EOF"alert: 2000conditionID: "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"EOFlenses-clialertsettingconditionsetalert_cond.yaml# For "Data Produced" type of alert rulescat>data_produced_alert.yaml<<-"EOF"topic: "my-yaml-topic"alert: 5000more-than: 6990duration: "PT6H"EOFlenses-clialertsettingconditionsetdata_produced_alert.yml
lenses-clialertsettingconditiondelete \--alert=2000 \--condition="7643d1ec-73f9-4913-95d1-87e62f1ec172"# For "Data Produced" type of alert rulesalertsettingconditiondelete \--alert5000 \--condition=19e7791d-9fbf-4b6b-b198-8490e5e30d29