5.0

Alert channels

The CLI can manage Alert channels.

List alert channels 

lenses-cli alertchannels

View an alert channel details 

lenses-cli alertchannels --details

List alert channels with possible flags 

lenses-cli alertchannels \
--page=1 \
--pageSize=10 \
--sortField="name" \
--sortOrder="asc" \
--templateName="test" \
--channelName="slack"

List alert channel templates 

When creating alert channels, one of existing predefined channel templates needs to be used.

Such a command lists all available alert channel templates:

lenses-cli alertchannel-templates

To get all details, use JSON format:

lenses-cli alertchannel-templates --output JSON

Create new alert channel 

lenses-cli alertchannels create \
--name "my-slack-channel" \
--connectionName="my-slack-connection" \
--templateName="Slack" \
--properties="[{\"key\":\"username\",\"value\":\"@johndoe\"},{\"key\":\"channel\",\"value\":\"company-slack-channel\"}]"

Create new alert channel using a YAML file

name: "My-alert-channel"
templateName: "Slack"
connectionName: "my-slack-connection"
properties:
 - key: "username"
   value: "@johndoe"
 - key: "channel"
   value: "company-slack-channel"

Having above file, execute following command:
lenses-cli alertchannels create alert_chann.yml

Update an alert channel 

lenses-cli alertchannels update \
  --id "ID_OF_THE_CHANNEL_TO_BE_UPDATED" \
  --name "my-slack-channel" \
  --connectionName="my-slack-connection" \
  --templateName="Slack" \
  --properties="[{\"key\":\"username\",\"value\":\"@johndoe\"},{\"key\":\"channel\",\"value\":\"company-slack-channel\"}]"

Delete an alert channel 

lenses-cli alertchannels delete \
    --channelID="f47d09f5-e6d4-4436-956f-09bb2aadee83"

Assign alert channels to alert rules 

lenses-cli alert setting set \
    --id 1000 \
    --enable=false \
    --channels="143315dd-80bf-4833-a13a-394be06dda87" \
    --channels="f9d6140c-4823-4157-a93c-5147aa0e2f29"

Using file:

id: 1000
enable: false
channels:
- "34fc6c67-106c-4ec1-81c4-818aa608bcd4"
- "143315dd-80bf-4833-a13a-394be06dda87"

lenses-cli alert setting set alert_sett.yaml