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.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnCompositeAlarm(Construct scope, String id, CfnCompositeAlarmProps props) Create a newAWS::CloudWatch::CompositeAlarm.protectedCfnCompositeAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnCompositeAlarm(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 theALARMstate.The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARMstate.The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARMstate.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.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetActionsEnabled(Boolean value) Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.voidsetActionsEnabled(IResolvable value) Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.voidsetActionsSuppressor(String value) Actions will be suppressed if the suppressor alarm is in theALARMstate.voidThe maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARMstate.voidThe maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARMstate.voidsetAlarmActions(List<String> value) The actions to execute when this alarm transitions to the ALARM state from any other state.voidsetAlarmDescription(String value) The description for the composite alarm.voidsetAlarmName(String value) The name for the composite alarm.voidsetAlarmRule(String value) An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.voidsetInsufficientDataActions(List<String> value) The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.voidsetOkActions(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, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
inspectin 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:
renderPropertiesin 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:
getCfnPropertiesin 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
AlarmRulesyntax, 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
AlarmRulesyntax, 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 theALARMstate.ActionsSuppressorcan be an AlarmName or an Amazon Resource Name (ARN) from an existing alarm. -
setActionsSuppressor
Actions will be suppressed if the suppressor alarm is in theALARMstate.ActionsSuppressorcan 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 theALARMstate.After this time, the composite alarm performs its actions.
ExtensionPeriodis required only whenActionsSuppressoris specified. -
setActionsSuppressorExtensionPeriod
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of theALARMstate.After this time, the composite alarm performs its actions.
ExtensionPeriodis required only whenActionsSuppressoris specified. -
getActionsSuppressorWaitPeriod
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARMstate.After this time, the composite alarm performs its actions.
WaitPeriodis required only whenActionsSuppressoris specified. -
setActionsSuppressorWaitPeriod
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into theALARMstate.After this time, the composite alarm performs its actions.
WaitPeriodis required only whenActionsSuppressoris 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 .
-