CompositeAlarm
- class aws_cdk.aws_cloudwatch.CompositeAlarm(scope, id, *, alarm_rule, actions_enabled=None, actions_suppressor=None, actions_suppressor_extension_period=None, actions_suppressor_wait_period=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: trueactions_suppressor (
Optional
[IAlarm
]) – Actions will be suppressed if the suppressor alarm is in the ALARM state. Default: - alarm will not be suppressed.actions_suppressor_extension_period (
Optional
[Duration
]) – The maximum duration that the composite alarm waits after suppressor alarm goes out of the ALARM state. After this time, the composite alarm performs its actions. Default: - 1 minute extension period will be set.actions_suppressor_wait_period (
Optional
[Duration
]) – The maximum duration that the composite alarm waits for the suppressor alarm to go into the ALARM state. After this time, the composite alarm performs its actions. Default: - 1 minute wait period will be set.alarm_description (
Optional
[str
]) – Description for the alarm. Default: - No description.composite_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 SnsAction or AutoScalingAction.
- Parameters:
actions (
IAlarmAction
) –- Return type:
None
- add_insufficient_data_action(*actions)
Trigger this action if there is insufficient data to evaluate the alarm.
Typically SnsAction or AutoScalingAction.
- Parameters:
actions (
IAlarmAction
) –- Return type:
None
- add_ok_action(*actions)
Trigger this action if the alarm returns from breaching state into ok state.
Typically SnsAction or AutoScalingAction.
- 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 tree node.
- 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)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool