class CompositeAlarm (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.CompositeAlarm |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#CompositeAlarm |
Java | software.amazon.awscdk.services.cloudwatch.CompositeAlarm |
Python | aws_cdk.aws_cloudwatch.CompositeAlarm |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » CompositeAlarm |
Implements
IConstruct
, IDependable
, IResource
, IAlarm
, IAlarm
A Composite Alarm based on Alarm Rule.
Example
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)),
),
cloudwatch.AlarmRule.fromBoolean(false),
);
new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', {
alarmRule,
});
Initializer
new CompositeAlarm(scope: Construct, id: string, props: CompositeAlarmProps)
Parameters
- scope
Construct
- id
string
- props
Composite
Alarm Props
Construct Props
Name | Type | Description |
---|---|---|
alarm | IAlarm | Expression that specifies which other alarms are to be evaluated to determine this composite alarm's state. |
actions | boolean | Whether the actions for this alarm are enabled. |
actions | IAlarm | Actions will be suppressed if the suppressor alarm is in the ALARM state. |
actions | Duration | The maximum duration that the composite alarm waits after suppressor alarm goes out of the ALARM state. |
actions | Duration | The maximum duration that the composite alarm waits for the suppressor alarm to go into the ALARM state. |
alarm | string | Description for the alarm. |
composite | string | Name of the alarm. |
alarmRule
Type:
IAlarm
Expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.
actionsEnabled?
Type:
boolean
(optional, default: true)
Whether the actions for this alarm are enabled.
actionsSuppressor?
Type:
IAlarm
(optional, default: alarm will not be suppressed.)
Actions will be suppressed if the suppressor alarm is in the ALARM state.
actionsSuppressorExtensionPeriod?
Type:
Duration
(optional, default: 1 minute extension period will be set.)
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.
actionsSuppressorWaitPeriod?
Type:
Duration
(optional, default: 1 minute wait period will be set.)
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.
alarmDescription?
Type:
string
(optional, default: No description.)
Description for the alarm.
compositeAlarmName?
Type:
string
(optional, default: Automatically generated name.)
Name of the alarm.
Properties
Name | Type | Description |
---|---|---|
alarm | string | ARN of this alarm. |
alarm | string | Name of this alarm. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
alarmArn
Type:
string
ARN of this alarm.
alarmName
Type:
string
Name of this alarm.
env
Type:
Resource
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
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
add | Trigger this action if the alarm fires. |
add | Trigger this action if there is insufficient data to evaluate the alarm. |
add | Trigger this action if the alarm returns from breaching state into ok state. |
apply | Apply the given removal policy to this resource. |
render | AlarmRule indicating ALARM state for Alarm. |
to | Returns a string representation of this construct. |
static from | Import an existing CloudWatch composite alarm provided an ARN. |
static from | Import an existing CloudWatch composite alarm provided an Name. |
AlarmAction(...actions)
addpublic addAlarmAction(...actions: IAlarmAction[]): void
Parameters
- actions
IAlarm
Action
Trigger this action if the alarm fires.
Typically SnsAction or AutoScalingAction.
InsufficientDataAction(...actions)
addpublic addInsufficientDataAction(...actions: IAlarmAction[]): void
Parameters
- actions
IAlarm
Action
Trigger this action if there is insufficient data to evaluate the alarm.
Typically SnsAction or AutoScalingAction.
OkAction(...actions)
addpublic addOkAction(...actions: IAlarmAction[]): void
Parameters
- actions
IAlarm
Action
Trigger this action if the alarm returns from breaching state into ok state.
Typically SnsAction or AutoScalingAction.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
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
).
AlarmRule()
renderpublic renderAlarmRule(): string
Returns
string
AlarmRule indicating ALARM state for Alarm.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
CompositeAlarmArn(scope, id, compositeAlarmArn)
static frompublic static fromCompositeAlarmArn(scope: Construct, id: string, compositeAlarmArn: string): IAlarm
Parameters
- scope
Construct
— The parent creating construct (usuallythis
). - id
string
— The construct's name. - compositeAlarmArn
string
— Composite Alarm ARN (i.e. arn:aws:cloudwatch::<account-id>:alarm:CompositeAlarmName).
Returns
Import an existing CloudWatch composite alarm provided an ARN.
CompositeAlarmName(scope, id, compositeAlarmName)
static frompublic static fromCompositeAlarmName(scope: Construct, id: string, compositeAlarmName: string): IAlarm
Parameters
- scope
Construct
— The parent creating construct (usuallythis
). - id
string
— The construct's name. - compositeAlarmName
string
— Composite Alarm Name.
Returns
Import an existing CloudWatch composite alarm provided an Name.