AtLeastOptions

class aws_cdk.aws_cloudwatch.AtLeastOptions(*, operands, threshold)

Bases: object

Options for the AT_LEAST AlarmRule wrapper function.

Parameters:
  • operands (Sequence[IAlarm]) – Alarms to evaluate in the AT_LEAST expression. Must contain at least one alarm.

  • threshold (AtLeastThreshold) – Threshold for the AT_LEAST expression. Use AtLeastThreshold.count() for an absolute number or AtLeastThreshold.percentage() for a percentage.

ExampleMetadata:

infused

Example:

# alarm1: cloudwatch.Alarm
# alarm2: cloudwatch.Alarm
# alarm3: cloudwatch.Alarm
# alarm4: cloudwatch.Alarm


alarm_rule = cloudwatch.AlarmRule.any_of(
    cloudwatch.AlarmRule.all_of(
        cloudwatch.AlarmRule.any_of(alarm1,
            cloudwatch.AlarmRule.from_alarm(alarm2, cloudwatch.AlarmState.OK), alarm3),
        cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.from_alarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA)),
        # AT_LEAST with count: at least 2 of these alarms must be in ALARM state
        cloudwatch.AlarmRule.at_least(cloudwatch.AlarmState.ALARM,
            operands=[alarm1, alarm2, alarm3],
            threshold=cloudwatch.AtLeastThreshold.count(2)
        ),
        # AT_LEAST with percentage and NOT: at least 60% must NOT be in OK state
        cloudwatch.AlarmRule.at_least_not(cloudwatch.AlarmState.OK,
            operands=[alarm1, alarm2, alarm3],
            threshold=cloudwatch.AtLeastThreshold.percentage(60)
        )),
    cloudwatch.AlarmRule.from_boolean(False))

cloudwatch.CompositeAlarm(self, "MyAwesomeCompositeAlarm",
    alarm_rule=alarm_rule
)

Attributes

operands

Alarms to evaluate in the AT_LEAST expression.

Must contain at least one alarm.

threshold

Threshold for the AT_LEAST expression.

Use AtLeastThreshold.count() for an absolute number or AtLeastThreshold.percentage() for a percentage.