@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:40.978Z") public class CfnCompositeAlarm extends CfnResource implements IInspectable
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();
Modifier and Type | Class and Description |
---|---|
static class |
CfnCompositeAlarm.Builder
A fluent builder for
CfnCompositeAlarm . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnCompositeAlarm(Construct scope,
java.lang.String id,
CfnCompositeAlarmProps props)
Create a new `AWS::CloudWatch::CompositeAlarm`.
|
protected |
CfnCompositeAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnCompositeAlarm(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getActionsEnabled()
Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.
|
java.lang.String |
getActionsSuppressor()
Actions will be suppressed if the suppressor alarm is in the `ALARM` state.
|
java.lang.Number |
getActionsSuppressorExtensionPeriod()
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of the `ALARM` state.
|
java.lang.Number |
getActionsSuppressorWaitPeriod()
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into the `ALARM` state.
|
java.util.List<java.lang.String> |
getAlarmActions()
The actions to execute when this alarm transitions to the ALARM state from any other state.
|
java.lang.String |
getAlarmDescription()
The description for the composite alarm.
|
java.lang.String |
getAlarmName()
The name for the composite alarm.
|
java.lang.String |
getAlarmRule()
An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.
|
java.lang.String |
getAttrArn()
The ARN of the composite alarm, such as `arn:aws:cloudwatch:us-west-2:123456789012:alarm/CompositeAlarmName` .
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.util.List<java.lang.String> |
getInsufficientDataActions()
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
|
java.util.List<java.lang.String> |
getOkActions()
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.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setActionsEnabled(java.lang.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(java.lang.String value)
Actions will be suppressed if the suppressor alarm is in the `ALARM` state.
|
void |
setActionsSuppressorExtensionPeriod(java.lang.Number value)
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of the `ALARM` state.
|
void |
setActionsSuppressorWaitPeriod(java.lang.Number value)
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into the `ALARM` state.
|
void |
setAlarmActions(java.util.List<java.lang.String> value)
The actions to execute when this alarm transitions to the ALARM state from any other state.
|
void |
setAlarmDescription(java.lang.String value)
The description for the composite alarm.
|
void |
setAlarmName(java.lang.String value)
The name for the composite alarm.
|
void |
setAlarmRule(java.lang.String value)
An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.
|
void |
setInsufficientDataActions(java.util.List<java.lang.String> value)
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
|
void |
setOkActions(java.util.List<java.lang.String> value)
The actions to execute when this alarm transitions to the OK state from any other state.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnCompositeAlarm(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnCompositeAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnCompositeAlarm(Construct scope, java.lang.String id, CfnCompositeAlarmProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrArn()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getAlarmRule()
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:
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 .
public void setAlarmRule(java.lang.String value)
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:
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 .
public java.lang.Object getActionsEnabled()
The default is TRUE.
public void setActionsEnabled(java.lang.Boolean value)
The default is TRUE.
public void setActionsEnabled(IResolvable value)
The default is TRUE.
public java.lang.String getActionsSuppressor()
ActionsSuppressor
can be an AlarmName or an Amazon Resource Name (ARN) from an existing alarm.
public void setActionsSuppressor(java.lang.String value)
ActionsSuppressor
can be an AlarmName or an Amazon Resource Name (ARN) from an existing alarm.
public java.lang.Number getActionsSuppressorExtensionPeriod()
After this time, the composite alarm performs its actions.
ExtensionPeriod
is required only whenActionsSuppressor
is specified.
public void setActionsSuppressorExtensionPeriod(java.lang.Number value)
After this time, the composite alarm performs its actions.
ExtensionPeriod
is required only whenActionsSuppressor
is specified.
public java.lang.Number getActionsSuppressorWaitPeriod()
After this time, the composite alarm performs its actions.
WaitPeriod
is required only whenActionsSuppressor
is specified.
public void setActionsSuppressorWaitPeriod(java.lang.Number value)
After this time, the composite alarm performs its actions.
WaitPeriod
is required only whenActionsSuppressor
is specified.
public java.util.List<java.lang.String> getAlarmActions()
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 .
public void setAlarmActions(java.util.List<java.lang.String> value)
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 .
public java.lang.String getAlarmDescription()
public void setAlarmDescription(java.lang.String value)
public java.lang.String getAlarmName()
This name must be unique within your AWS account.
public void setAlarmName(java.lang.String value)
This name must be unique within your AWS account.
public java.util.List<java.lang.String> getInsufficientDataActions()
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 .
public void setInsufficientDataActions(java.util.List<java.lang.String> value)
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 .
public java.util.List<java.lang.String> getOkActions()
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 .
public void setOkActions(java.util.List<java.lang.String> value)
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 .