AlarmState

class aws_cdk.aws_cloudwatch.AlarmState(*values)

Bases: Enum

Enumeration indicates state of Alarm used in building Alarm Rule.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_cloudwatch as cloudwatch


metric = cloudwatch.Metric(
    namespace="MyNamespace",
    metric_name="MyMetric",
    dimensions_map={"MyDimension": "MyDimensionValue"}
)
alarm = cloudwatch.Alarm(self, "MyAlarm",
    metric=metric,
    threshold=100,
    evaluation_periods=3,
    datapoints_to_alarm=2
)

topic_rule = iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id FROM 'device/+/data'"),
    actions=[
        actions.CloudWatchSetAlarmStateAction(alarm,
            reason="AWS Iot Rule action is triggered",
            alarm_state_to_set=cloudwatch.AlarmState.ALARM
        )
    ]
)

Attributes

ALARM

State indicates resource is in ALARM.

INSUFFICIENT_DATA

State indicates there is not enough data to determine is resource is in ALARM.

OK

State indicates resource is not in ALARM.