Class CfnCompositeAlarm

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-24T21:00:26.861Z") @Stability(Stable) public class CfnCompositeAlarm extends CfnResource implements IInspectable, ITaggableV2
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.

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"))
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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 software.constructs.Construct scope, @NotNull String id, @NotNull CfnCompositeAlarmProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The ARN of the composite alarm, such as arn:aws:cloudwatch:us-west-2:123456789012:alarm/CompositeAlarmName .
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getAlarmRule

      @Stability(Stable) @NotNull public String getAlarmRule()
      An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.
    • setAlarmRule

      @Stability(Stable) public void setAlarmRule(@NotNull String value)
      An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state.
    • getActionsEnabled

      @Stability(Stable) @Nullable public Object getActionsEnabled()
      Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.
    • setActionsEnabled

      @Stability(Stable) public void setActionsEnabled(@Nullable Boolean value)
      Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.
    • setActionsEnabled

      @Stability(Stable) public void setActionsEnabled(@Nullable IResolvable value)
      Indicates whether actions should be executed during any changes to the alarm state of the composite alarm.
    • getActionsSuppressor

      @Stability(Stable) @Nullable public String getActionsSuppressor()
      Actions will be suppressed if the suppressor alarm is in the ALARM state.
    • setActionsSuppressor

      @Stability(Stable) public void setActionsSuppressor(@Nullable String value)
      Actions will be suppressed if the suppressor alarm is in the ALARM state.
    • getActionsSuppressorExtensionPeriod

      @Stability(Stable) @Nullable public Number getActionsSuppressorExtensionPeriod()
      The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of the ALARM state.
    • setActionsSuppressorExtensionPeriod

      @Stability(Stable) public void setActionsSuppressorExtensionPeriod(@Nullable Number value)
      The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of the ALARM state.
    • getActionsSuppressorWaitPeriod

      @Stability(Stable) @Nullable public Number getActionsSuppressorWaitPeriod()
      The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into the ALARM state.
    • setActionsSuppressorWaitPeriod

      @Stability(Stable) public void setActionsSuppressorWaitPeriod(@Nullable Number value)
      The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into the ALARM state.
    • getAlarmActions

      @Stability(Stable) @Nullable public List<String> getAlarmActions()
      The actions to execute when this alarm transitions to the ALARM state from any other state.
    • setAlarmActions

      @Stability(Stable) public void setAlarmActions(@Nullable List<String> value)
      The actions to execute when this alarm transitions to the ALARM state from any other state.
    • getAlarmDescription

      @Stability(Stable) @Nullable public String getAlarmDescription()
      The description for the composite alarm.
    • setAlarmDescription

      @Stability(Stable) public void setAlarmDescription(@Nullable String value)
      The description for the composite alarm.
    • getAlarmName

      @Stability(Stable) @Nullable public String getAlarmName()
      The name for the composite alarm.
    • setAlarmName

      @Stability(Stable) public void setAlarmName(@Nullable String value)
      The name for the composite alarm.
    • getInsufficientDataActions

      @Stability(Stable) @Nullable public List<String> getInsufficientDataActions()
      The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
    • setInsufficientDataActions

      @Stability(Stable) public void setInsufficientDataActions(@Nullable List<String> value)
      The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
    • getOkActions

      @Stability(Stable) @Nullable public List<String> getOkActions()
      The actions to execute when this alarm transitions to the OK state from any other state.
    • setOkActions

      @Stability(Stable) public void setOkActions(@Nullable List<String> value)
      The actions to execute when this alarm transitions to the OK state from any other state.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      A list of key-value pairs to associate with the alarm.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      A list of key-value pairs to associate with the alarm.