AlarmState Enum
Enumeration indicates state of Alarm used in building Alarm Rule.
Example
ts
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
const metric = new cloudwatch.Metric({
namespace: 'MyNamespace',
metricName: 'MyMetric',
dimensionsMap: { MyDimension: 'MyDimensionValue' },
});
const alarm = new cloudwatch.Alarm(this, 'MyAlarm', {
metric: metric,
threshold: 100,
evaluationPeriods: 3,
datapointsToAlarm: 2,
});
const topicRule = new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"),
actions: [
new actions.CloudWatchSetAlarmStateAction(alarm, {
reason: 'AWS Iot Rule action is triggered',
alarmStateToSet: cloudwatch.AlarmState.ALARM,
}),
],
});
Members
| Member | Description |
|---|---|
ALARM | State indicates resource is in ALARM. |
OK | State indicates resource is not in ALARM. |
INSUFFICIENT_DATA | State indicates there is not enough data to determine is resource is in ALARM. |
Referenced by
AlarmStatusWidgetProps.statesstatesstatesStatesStatesCloudWatchSetAlarmStateActionProps.alarmStateToSetalarm_state_to_setalarmStateToSetAlarmStateToSetAlarmStateToSet