CompositeAlarm
- class aws_cdk.aws_cloudwatch.CompositeAlarm(scope, id, *, alarm_rule, actions_enabled=None, alarm_description=None, composite_alarm_name=None)
Bases:
AlarmBase
A Composite Alarm based on Alarm Rule.
- 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))), cloudwatch.AlarmRule.from_boolean(False)) cloudwatch.CompositeAlarm(self, "MyAwesomeCompositeAlarm", alarm_rule=alarm_rule )
- Parameters
scope (
Construct
) –id (
str
) –alarm_rule (
IAlarmRule
) – Expression that specifies which other alarms are to be evaluated to determine this composite alarm’s state.actions_enabled (
Optional
[bool
]) – Whether the actions for this alarm are enabled. Default: truealarm_description (
Optional
[str
]) – Description for the alarm. Default: No descriptioncomposite_alarm_name (
Optional
[str
]) – Name of the alarm. Default: Automatically generated name
Methods
- add_alarm_action(*actions)
Trigger this action if the alarm fires.
Typically the ARN of an SNS topic or ARN of an AutoScaling policy.
- Parameters
actions (
IAlarmAction
) –- Return type
None
- add_insufficient_data_action(*actions)
Trigger this action if there is insufficient data to evaluate the alarm.
Typically the ARN of an SNS topic or ARN of an AutoScaling policy.
- Parameters
actions (
IAlarmAction
) –- Return type
None
- add_ok_action(*actions)
Trigger this action if the alarm returns from breaching state into ok state.
Typically the ARN of an SNS topic or ARN of an AutoScaling policy.
- Parameters
actions (
IAlarmAction
) –- Return type
None
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
RemovalPolicy
) –- Return type
None
- render_alarm_rule()
AlarmRule indicating ALARM state for Alarm.
- Return type
str
- to_string()
Returns a string representation of this construct.
- Return type
str
Attributes
- alarm_arn
ARN of this alarm.
- Attribute
true
- alarm_name
Name of this alarm.
- Attribute
true
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- node
The construct tree node associated with this construct.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_composite_alarm_arn(scope, id, composite_alarm_arn)
Import an existing CloudWatch composite alarm provided an ARN.
- classmethod from_composite_alarm_name(scope, id, composite_alarm_name)
Import an existing CloudWatch composite alarm provided an Name.
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters
x (
Any
) –- Return type
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters
construct (
IConstruct
) –- Return type
bool