Consumer Alert Creation Via CLI

I can’t visualize the Lenses interface, so I only have access via the terminal. What would be the necessary steps to create a consumer alert via the CLI?

Hi ejhon_s,

First, you need to download the lenses-cli for your Lenses version. It is recommended to use version 5.3.x of Lenses. After that, you need to log in to Lenses via CLI to be able to execute commands in Lenses. Once these two steps are completed, you can run the following command:

./lenses-cli alert setting condition set --alert=2000 --topic=my-topic --group=my-group-consumer --threshold=100 --mode=PerTopicMode

The explanation of this command is as follows: “alert setting condition set” is used to define what you want to do, in this case, set a rule. “–alert=2000” is the type of alert, in this case, for consumers. You can find a list of alert types at this link: Alert Rules | Lenses.io Help Center. The parameters “–topic” and “–group” refer to the topic and consumer group for the topic. The threshold is the lag limit to trigger the alert, and “–mode” refers to whether the alert is per partition or per topic.