Skip to content

2.25.2.0-b106

@Deepti-yb Deepti-yb tagged this 06 Mar 10:37
Summary:
Alert command:
```
yba alert
Manage YugabyteDB Anywhere alerts

Usage:
  yba alert [flags]
  yba alert [command]

Available Commands:
  acknowledge Acknowledge YugabyteDB Anywhere alert
  count       Count YugabyteDB Anywhere alerts
  describe    Describe YugabyteDB Anywhere alert
  list        List YugabyteDB Anywhere alerts
  policy      Manage YugabyteDB Anywhere alert policies

Flags:
  -h, --help   help for alert

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

List alerts command:
```
yba alert list -h
List alerts in YugabyteDB Anywhere

Usage:
  yba alert list [flags]

Aliases:
  list, ls

Examples:
yba alert list --source-name <source-listname>

Flags:
      --configuration-uuid string    [Optional] Configuration UUID to filter alerts.
      --configuration-types string   [Optional] Comma separated list of configuration types.
      --severities string            [Optional] Comma separated list of severities. Allowed values: severe, warning.
      --source-uuids string          [Optional] Comma separated list of source UUIDs.
      --source-name string           [Optional] Source name to filter alerts.
      --states string                [Optional] Comma separated list of states. Allowed values: active, acknowledged, suspended, resolved.
      --uuids string                 [Optional] Comma separated list of alert UUIDs.
      --sorting-field string         [Optional] Field to sort alerts. Allowed values: severity, create-time, source-name, name, state, uuid. (default "create-time")
      --direction string             [Optional] Direction to sort alerts. Allowed values: asc, desc. (default "desc")
  -f, --force                        [Optional] Bypass the prompt for non-interactive usage.
  -h, --help                         help for list

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Describe alert:
```
yba alert describe -h
Describe alert in YugabyteDB Anywhere

Usage:
  yba alert describe [flags]

Aliases:
  describe, get

Examples:
yba alert describe --uuid <alert-uuid>

Flags:
  -u, --uuid string   [Required] UUID of alert to describe.
  -h, --help          help for describe

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Count alerts:
```
yba alert count -h
Count alerts in YugabyteDB Anywhere

Usage:
  yba alert count [flags]

Examples:
yba alert count

Flags:
      --configuration-uuid string    [Optional] Configuration UUID to filter alerts.
      --configuration-types string   [Optional] Comma separated list of configuration types.
      --severities string            [Optional] Comma separated list of severities. Allowed values: severe, warning.
      --source-uuids string          [Optional] Comma separated list of source UUIDs.
      --source-name string           [Optional] Source name to filter alerts.
      --states string                [Optional] Comma separated list of states. Allowed values: active, acknowledged, suspended, resolved.
      --uuids string                 [Optional] Comma separated list of alert UUIDs.
  -h, --help                         help for count

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Acknowledge alert:
```
yba alert acknowledge -h
Acknowledge alert in YugabyteDB Anywhere

Usage:
  yba alert acknowledge [flags]

Examples:
yba alert acknowledge --uuid <alert-uuid>

Flags:
  -u, --uuid string   [Required] UUID of alert to acknowledge.
  -h, --help          help for acknowledge

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Policy commands:
```
yba alert policy
Manage YugabyteDB Anywhere alert policies

Usage:
  yba alert policy [flags]
  yba alert policy [command]

Aliases:
  policy, configuration

Available Commands:
  create      Create an alert policy in YugabyteDB Anywhere
  delete      Delete YugabyteDB Anywhere alert policy
  describe    Describe YugabyteDB Anywhere alert policy
  list        List YugabyteDB Anywhere alerts
  test-alert  Send a test alert corresponding to YugabyteDB Anywhere alert policy
  update      Update an alert policy in YugabyteDB Anywhere

Flags:
  -h, --help   help for policy

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Create policy:
```
yba alert policy create -h
Create an alert policy in YugabyteDB Anywhere

Usage:
  yba alert policy create [flags]

Aliases:
  create, add

Examples:
yba alert policy create --name <alert-policy-name> \
                --alert-type <alert-type> --alert-severity <alert-severity> --alert-config <alert-config>

Flags:
  -n, --name string               [Required] Name of alert policy to create. Use single quotes ('') to provide values with special characters.
      --description string        [Optional] Description of alert policy to create.
      --target-uuids string       [Optional] Comma separated list of target UUIDs for the alert policy. If left empty, the alert policy will be created for all targets of the target type. Allowed for target type: universe.
      --threshold stringArray     [Optional] Threshold for the configuration corresponding to severity. Each threshold needs to be added as a separate --threshold flag.Provide the following double colon (::) separated fields as key-value pairs: "severity=<severity>::condition=<condition>::threshold=<threshold>". Allowed values for severity: severe, warning. Allowed values for condition: greater-than, less-than, not-equal. Threshold should be a double. Example: "severity=severe::condition=greater-than::threshold=60000".
      --template string           [Required] Template name for the alert policy. Use single quotes ('') to provide values with special characters. Run "yba alert template list" to check list of available template names.
      --duration int              [Optional] Duration in seconds, while condition is met to raise an alert. (default 0)
      --destination-type string   [Optional] Destination type to create alert policy. Allowed values: no, default, selected
      --destination string        [Optional] Destination name to send alerts. Run "yba alert destination list" to check list of available destinations. Required if destination-type is selected.
  -h, --help                      help for create

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Delete policy:
```
yba alert policy delete -h
Delete an alert policy in YugabyteDB Anywhere

Usage:
  yba alert policy delete [flags]

Aliases:
  delete, remove, rm

Examples:
yba alert policy delete --name <alert-configuration-name>

Flags:
  -n, --name string   [Required] Name of alert policy to delete. Use single quotes ('') to provide values with special characters.
  -f, --force         [Optional] Bypass the prompt for non-interactive usage.
  -h, --help          help for delete

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Describe policy:
```
Describe an alert policy in YugabyteDB Anywhere

Usage:
  yba alert policy describe [flags]

Aliases:
  describe, get

Examples:
yba alert policy describe --name <alert-configuration-name>

Flags:
  -n, --name string   [Required] Name of alert policy to describe. Use single quotes ('') to provide values with special characters.
  -h, --help          help for describe

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default
```

List policies:
```
yba alert policy list -h
List alert policiess in YugabyteDB Anywhere

Usage:
  yba alert policy list [flags]

Aliases:
  list, ls

Examples:
yba alert policy list --source-name <source-name>

Flags:
      --active                    [Optional] Filter active alert configurations. (default true)
      --destination-type string   [Optional] Destination type to filter alert configurations. Allowed values: no, default, selected
      --destination string        [Optional] Destination name to filter alert configurations. Required if destination-type is selected.
      --name string               [Optional] Name to filter alert configurations.
      --severity string           [Optional] Severity to filter alert configurations. Allowed values: severe, warning.
      --target-uuids string       [Optional] Comma separated list of target UUIDs for the alert policy.
      --target-type string        [Optional] Target type to filter alert configurations. Allowed values: platform, universe.
      --template string           [Optional] Template type to filter alert configurations. Allowed values (case-sensitive) are listed: https://github.com/yugabyte/yugabyte-db/blob/master/managed/src/main/java/com/yugabyte/yw/common/AlertTemplate.java
      --uuids string              [Optional] Comma separated list of alert policy UUIDs.
      --sorting-field string      [Optional] Field to sort alerts. Allowed values: uuid, name, active, target-type, target, create-time, template, severity, destination, alert-count. (default "create-time")
      --direction string          [Optional] Direction to sort alerts. Allowed values: asc, desc. (default "desc")
  -f, --force                     [Optional] Bypass the prompt for non-interactive usage.
  -h, --help                      help for list

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Test alert:
```
yba alert policy test-alert -h
Send a test alert corresponding to an alert policy in YugabyteDB Anywhere

Usage:
  yba alert policy test-alert [flags]

Aliases:
  test-alert, testalert, test

Examples:
yba alert policy test-alert --name <alert-configuration-name>

Flags:
  -n, --name string   [Required] Name of alert policy to test alerts. Use single quotes ('') to provide values with special characters.
  -h, --help          help for test-alert

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Update alert policies:
```
yba alert policy update -h
Update an alert policy in YugabyteDB Anywhere

Usage:
  yba alert policy update [flags]

Aliases:
  update, edit

Examples:
yba alert policy update --name <alert-policy-name> \
                --alert-type <alert-type> --alert-severity <alert-severity> --alert-config <alert-config>

Flags:
  -n, --name string                    [Required] Name of alert policy to update. Use single quotes ('') to provide values with special characters.
      --new-name string                [Optional] Update name of alert policy.
      --description string             [Optional] Update description of alert policy.
      --target-type string             [Optional] Update target type of alert policy. Allowed values: platform, universe.
      --target-uuids string            [Optional] Comma separated list of target UUIDs for the alert policy. If empty string is specified, the alert policy will be updated for all targets of the target type. Allowed for target type: universe.
      --add-threshold stringArray      [Optional] Threshold for the configuration corresponding to severity.Each threshold needs to be added as a separate --add-threshold flag. Provide the following double colon (::) separated fields as key-value pairs: "severity=<severity>::condition=<condition>::threshold=<threshold>". Allowed values for severity: severe, warning. Allowed values for condition: greater-than, less-than, not-equal. Threshold should be a double. Example: "severity=severe::condition=greater-than::threshold=60000".
      --edit-threshold stringArray     [Optional] Threshold for the configuration corresponding to severity. Each threshold needs to be edited as a separate --edit-threshold flag.Provide the following double colon (::) separated fields as key-value pairs: "severity=<severity>::condition=<condition>::threshold=<threshold>". Allowed values for severity: severe, warning. Allowed values for condition: greater-than, less-than, not-equal. Threshold should be a double. Example: "severity=severe::condition=greater-than::threshold=60000".
      --remove-threshold stringArray   [Optional] Provide the comma separated severities to be removed from threshold. Allowed values: severe, warning.
      --threshold-unit string          [Optional] Update threshold unit for the configuration. Allowed values are listed: https://github.com/yugabyte/yugabyte-db/blob/master/managed/src/main/java/com/yugabyte/yw/models/common/Unit.java.
      --template string                [Optional] Update template name for the alert policy. Allowed values (case-sensitive) are listed: https://github.com/yugabyte/yugabyte-db/blob/master/managed/src/main/java/com/yugabyte/yw/common/AlertTemplate.java
      --duration int                   [Optional] Update duration in seconds, while condition is met to raise an alert.
       --destination-type string        [Optional] Destination type to update alert policy. Allowed values: no, default, selected
      --destination string             [Optional] Destination name to send alerts. Run "yba alert destination list" to check list of available destinations. Required if destination-type is selected.
      --state string                   [Optional] Set state of the alert policy. Allowed values: enable, disable.) (default "enable")
  -h, --help                           help for update

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Test Plan:
Describe alert policy:
```
yba alert policy get -n dkumar-cli
General
Name         UUID                                   Target Type   Destination   Is Active
dkumar-cli   e8f63a74-9926-461b-927a-ec44cde5886c   UNIVERSE                    true

Target
All targets of target type UNIVERSE

Template                                        Description
YSQL P99 latency is high(YSQL_OP_P99_LATENCY)

Create Time                       Alert Count   Duration (in seconds)
Tue, 04 Mar 2025 13:06:21 +0000   0.00          0

Maintenance Window UUIDs
-

Labels
null

Threshold Unit
MILLISECOND

Thresholds
{
  "SEVERE": {
    "condition": "GREATER_THAN",
    "threshold": 6000
  }
}
```

Deleting policy:
```
yba alert policy  rm -n dkumar-cli
? Are you sure you want to delete alert policy: dkumar-cli Yes
The alert policy dkumar-cli (a53f5b66-74a8-4c7a-b69a-5c05660bbb36) has been deleted
```

Creating policy:
```
yba alert policy create --name dkumar-cli-1  --template "YSQL P99 latency is high" --destination-type selected --destination dkumar
Successfully added alert policy dkumar-cli-1 (28f33f4a-a366-4fc7-930a-8b0d901d66b9)
Name           UUID                                   Target Type   Destination                                    Is Active
dkumar-cli-1   28f33f4a-a366-4fc7-930a-8b0d901d66b9   UNIVERSE      dkumar(21f96dc2-d678-4bd5-ae46-264a78dbab1e)   true
```

Updating policy:
```
yba alert policy update -n dkumar-cli-test --new-name dkumar-cli --destination-type no
Successfully updated alert policy dkumar-cli-test (e8f63a74-9926-461b-927a-ec44cde5886c)
Name         UUID                                   Target Type   Destination   Is Active
dkumar-cli   e8f63a74-9926-461b-927a-ec44cde5886c   UNIVERSE                    true
```

Reviewers: amalyshev, skurapati

Reviewed By: amalyshev

Subscribers: anijhawan, yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D41868
Assets 2
Loading