Class CfnCompositeAlarm
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::CloudWatch::CompositeAlarm
.
The AWS::CloudWatch::CompositeAlarm
type creates or updates a composite alarm. When you create a composite alarm, you specify a rule expression for the alarm that takes into account the alarm states of other alarms that you have created. The composite alarm goes into ALARM state only if all conditions of the rule are met.
The alarms specified in a composite alarm's rule expression can include metric alarms and other composite alarms.
Using composite alarms can reduce alarm noise. You can create multiple metric alarms, and also create a composite alarm and set up alerts only for the composite alarm. For example, you could create a composite alarm that goes into ALARM state only when more than one of the underlying metric alarms are in ALARM state.
Currently, the only alarm actions that can be taken by composite alarms are notifying SNS topics.
When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA. The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed. For a composite alarm, this initial time after creation is the only time that the alarm can be in INSUFFICIENT_DATA state.
When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.cloudwatch.*; CfnCompositeAlarm cfnCompositeAlarm = CfnCompositeAlarm.Builder.create(this, "MyCfnCompositeAlarm") .alarmRule("alarmRule") // the properties below are optional .actionsEnabled(false) .actionsSuppressor("actionsSuppressor") .actionsSuppressorExtensionPeriod(123) .actionsSuppressorWaitPeriod(123) .alarmActions(List.of("alarmActions")) .alarmDescription("alarmDescription") .alarmName("alarmName") .insufficientDataActions(List.of("insufficientDataActions")) .okActions(List.of("okActions")) .build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnCompositeAlarm
(Construct scope, String id, CfnCompositeAlarmProps props) Create a newAWS::CloudWatch::CompositeAlarm
.protected
CfnCompositeAlarm
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnCompositeAlarm
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionIndicates whether actions should be executed during any changes to the alarm state of the composite alarm.Actions will be suppressed if the suppressor alarm is in theALARM
state.The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARM
state.The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARM
state.The actions to execute when this alarm transitions to the ALARM state from any other state.The description for the composite alarm.The name for the composite alarm.An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.The ARN of the composite alarm, such asarn:aws:cloudwatch:us-west-2:123456789012:alarm/CompositeAlarmName
.The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.The actions to execute when this alarm transitions to the OK state from any other state.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setActionsEnabled
(Boolean value) Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.void
setActionsEnabled
(IResolvable value) Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.void
setActionsSuppressor
(String value) Actions will be suppressed if the suppressor alarm is in theALARM
state.void
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARM
state.void
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARM
state.void
setAlarmActions
(List<String> value) The actions to execute when this alarm transitions to the ALARM state from any other state.void
setAlarmDescription
(String value) The description for the composite alarm.void
setAlarmName
(String value) The name for the composite alarm.void
setAlarmRule
(String value) An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.void
setInsufficientDataActions
(List<String> value) The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.void
setOkActions
(List<String> value) The actions to execute when this alarm transitions to the OK state from any other state.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnCompositeAlarm
protected CfnCompositeAlarm(software.amazon.jsii.JsiiObjectRef objRef) -
CfnCompositeAlarm
protected CfnCompositeAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnCompositeAlarm
@Stability(Stable) public CfnCompositeAlarm(@NotNull Construct scope, @NotNull String id, @NotNull CfnCompositeAlarmProps props) Create a newAWS::CloudWatch::CompositeAlarm
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
The ARN of the composite alarm, such asarn:aws:cloudwatch:us-west-2:123456789012:alarm/CompositeAlarmName
. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getAlarmRule
An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.For each alarm that you reference, you designate a function that specifies whether that alarm needs to be in ALARM state, OK state, or INSUFFICIENT_DATA state. You can use operators (AND, OR and NOT) to combine multiple functions in a single expression. You can use parenthesis to logically group the functions in your expression.
You can use either alarm names or ARNs to reference the other alarms that are to be evaluated.
Functions can include the following:
- ALARM("alarm-name or alarm-ARN") is TRUE if the named alarm is in ALARM state.
- OK("alarm-name or alarm-ARN") is TRUE if the named alarm is in OK state.
- INSUFFICIENT_DATA("alarm-name or alarm-ARN") is TRUE if the named alarm is in INSUFFICIENT_DATA state.
- TRUE always evaluates to TRUE.
- FALSE always evaluates to FALSE.
TRUE and FALSE are useful for testing a complex AlarmRule structure, and for testing your alarm actions.
For more information about
AlarmRule
syntax, see PutCompositeAlarm in the Amazon CloudWatch API Reference . -
setAlarmRule
An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.For each alarm that you reference, you designate a function that specifies whether that alarm needs to be in ALARM state, OK state, or INSUFFICIENT_DATA state. You can use operators (AND, OR and NOT) to combine multiple functions in a single expression. You can use parenthesis to logically group the functions in your expression.
You can use either alarm names or ARNs to reference the other alarms that are to be evaluated.
Functions can include the following:
- ALARM("alarm-name or alarm-ARN") is TRUE if the named alarm is in ALARM state.
- OK("alarm-name or alarm-ARN") is TRUE if the named alarm is in OK state.
- INSUFFICIENT_DATA("alarm-name or alarm-ARN") is TRUE if the named alarm is in INSUFFICIENT_DATA state.
- TRUE always evaluates to TRUE.
- FALSE always evaluates to FALSE.
TRUE and FALSE are useful for testing a complex AlarmRule structure, and for testing your alarm actions.
For more information about
AlarmRule
syntax, see PutCompositeAlarm in the Amazon CloudWatch API Reference . -
getActionsEnabled
Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.The default is TRUE.
-
setActionsEnabled
Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.The default is TRUE.
-
setActionsEnabled
Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.The default is TRUE.
-
getActionsSuppressor
Actions will be suppressed if the suppressor alarm is in theALARM
state.ActionsSuppressor
can be an AlarmName or an Amazon Resource Name (ARN) from an existing alarm. -
setActionsSuppressor
Actions will be suppressed if the suppressor alarm is in theALARM
state.ActionsSuppressor
can be an AlarmName or an Amazon Resource Name (ARN) from an existing alarm. -
getActionsSuppressorExtensionPeriod
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARM
state.After this time, the composite alarm performs its actions.
ExtensionPeriod
is required only whenActionsSuppressor
is specified. -
setActionsSuppressorExtensionPeriod
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARM
state.After this time, the composite alarm performs its actions.
ExtensionPeriod
is required only whenActionsSuppressor
is specified. -
getActionsSuppressorWaitPeriod
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARM
state.After this time, the composite alarm performs its actions.
WaitPeriod
is required only whenActionsSuppressor
is specified. -
setActionsSuppressorWaitPeriod
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARM
state.After this time, the composite alarm performs its actions.
WaitPeriod
is required only whenActionsSuppressor
is specified. -
getAlarmActions
The actions to execute when this alarm transitions to the ALARM state from any other state.Each action is specified as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutCompositeAlarm in the Amazon CloudWatch API Reference .
-
setAlarmActions
The actions to execute when this alarm transitions to the ALARM state from any other state.Each action is specified as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutCompositeAlarm in the Amazon CloudWatch API Reference .
-
getAlarmDescription
The description for the composite alarm. -
setAlarmDescription
The description for the composite alarm. -
getAlarmName
The name for the composite alarm.This name must be unique within your AWS account.
-
setAlarmName
The name for the composite alarm.This name must be unique within your AWS account.
-
getInsufficientDataActions
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.Each action is specified as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutCompositeAlarm in the Amazon CloudWatch API Reference .
-
setInsufficientDataActions
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.Each action is specified as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutCompositeAlarm in the Amazon CloudWatch API Reference .
-
getOkActions
The actions to execute when this alarm transitions to the OK state from any other state.Each action is specified as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutCompositeAlarm in the Amazon CloudWatch API Reference .
-
setOkActions
The actions to execute when this alarm transitions to the OK state from any other state.Each action is specified as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutCompositeAlarm in the Amazon CloudWatch API Reference .
-