AtLeastThreshold Class
Threshold configuration for the AT_LEAST composite alarm rule expression.
Use AtLeastThreshold.count() for an absolute number or AtLeastThreshold.percentage() for a percentage-based threshold.
Example
ts
declare const alarm1: cloudwatch.Alarm;
declare const alarm2: cloudwatch.Alarm;
declare const alarm3: cloudwatch.Alarm;
declare const alarm4: cloudwatch.Alarm;
const alarmRule = cloudwatch.AlarmRule.anyOf(
cloudwatch.AlarmRule.allOf(
cloudwatch.AlarmRule.anyOf(
alarm1,
cloudwatch.AlarmRule.fromAlarm(alarm2, cloudwatch.AlarmState.OK),
alarm3,
),
cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.fromAlarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA)),
// AT_LEAST with count: at least 2 of these alarms must be in ALARM state
cloudwatch.AlarmRule.atLeast(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.atLeastNot(cloudwatch.AlarmState.OK, {
operands: [alarm1, alarm2, alarm3],
threshold: cloudwatch.AtLeastThreshold.percentage(60),
}),
),
cloudwatch.AlarmRule.fromBoolean(false),
);
new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', {
alarmRule,
});
Initializer
ts
new AtLeastThreshold()
python
AtLeastThreshold()
java
new AtLeastThreshold()
csharp
new AtLeastThreshold()
go
NewAtLeastThreshold()
Methods
count(count: number): AtLeastThreshold // chainable@staticmethod def count(count: int | float) -> AtLeastThresholdpublic static AtLeastThreshold count(Number count)public static AtLeastThreshold Count(double count)func Count(Count *float64) AtLeastThresholdstatic#Creates a count-based threshold for the AT_LEAST expression.
The count must be a positive integer between 1 and the number of operands.
1 parameter
Parameters
countcountcountcountCount— the minimum number of alarms that must be in the specified state.
percentage(percentage: number): AtLeastThreshold // chainable@staticmethod def percentage(percentage: int | float) -> AtLeastThresholdpublic static AtLeastThreshold percentage(Number percentage)public static AtLeastThreshold Percentage(double percentage)func Percentage(Percentage *float64) AtLeastThresholdstatic#Creates a percentage-based threshold for the AT_LEAST expression.
The percentage must be an integer between 1 and 100.
1 parameter
Parameters
percentagepercentagepercentagepercentagePercentage— the minimum percentage of alarms that must be in the specified state.