libZSservicesZSamazonka-cloudwatchZSamazonka-cloudwatch
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.CloudWatch.PutCompositeAlarm

Description

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.

It is possible to create a loop or cycle of composite alarms, where composite alarm A depends on composite alarm B, and composite alarm B also depends on composite alarm A. In this scenario, you can't delete any composite alarm that is part of the cycle because there is always still a composite alarm that depends on that alarm that you want to delete.

To get out of such a situation, you must break the cycle by changing the rule of one of the composite alarms in the cycle to remove a dependency that creates the cycle. The simplest change to make to break a cycle is to change the AlarmRule of one of the alarms to False.

Additionally, the evaluation of composite alarms stops if CloudWatch detects a cycle in the evaluation path.

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.

If you are an IAM user, you must have iam:CreateServiceLinkedRole to create a composite alarm that has Systems Manager OpsItem actions.

Synopsis

Creating a Request

data PutCompositeAlarm Source #

See: newPutCompositeAlarm smart constructor.

Constructors

PutCompositeAlarm' 

Fields

  • alarmDescription :: Maybe Text

    The description for the composite alarm.

  • oKActions :: Maybe [Text]

    The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).

    Valid Values: arn:aws:sns:region:account-id:sns-topic-name

  • actionsEnabled :: Maybe Bool

    Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. The default is TRUE.

  • insufficientDataActions :: Maybe [Text]

    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).

    Valid Values: arn:aws:sns:region:account-id:sns-topic-name

  • alarmActions :: Maybe [Text]

    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).

    Valid Values: arn:aws:sns:region:account-id:sns-topic-name | arn:aws:ssm:region:account-id:opsitem:severity

  • tags :: Maybe [Tag]

    A list of key-value pairs to associate with the composite alarm. You can associate as many as 50 tags with an alarm.

    Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values.

  • alarmName :: Text

    The name for the composite alarm. This name must be unique within the Region.

  • alarmRule :: Text

    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.

    Alarm names specified in AlarmRule can be surrounded with double-quotes ("), but do not have to be.

    The following are some examples of AlarmRule:

    • ALARM(CPUUtilizationTooHigh) AND ALARM(DiskReadOpsTooHigh) specifies that the composite alarm goes into ALARM state only if both CPUUtilizationTooHigh and DiskReadOpsTooHigh alarms are in ALARM state.
    • ALARM(CPUUtilizationTooHigh) AND NOT ALARM(DeploymentInProgress) specifies that the alarm goes to ALARM state if CPUUtilizationTooHigh is in ALARM state and DeploymentInProgress is not in ALARM state. This example reduces alarm noise during a known deployment window.
    • (ALARM(CPUUtilizationTooHigh) OR ALARM(DiskReadOpsTooHigh)) AND OK(NetworkOutTooHigh) goes into ALARM state if CPUUtilizationTooHigh OR DiskReadOpsTooHigh is in ALARM state, and if NetworkOutTooHigh is in OK state. This provides another example of using a composite alarm to prevent noise. This rule ensures that you are not notified with an alarm action on high CPU or disk usage if a known network problem is also occurring.

    The AlarmRule can specify as many as 100 "children" alarms. The AlarmRule expression can have as many as 500 elements. Elements are child alarms, TRUE or FALSE statements, and parentheses.

Instances

Instances details
Eq PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Read PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Show PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Generic PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Associated Types

type Rep PutCompositeAlarm :: Type -> Type #

NFData PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Methods

rnf :: PutCompositeAlarm -> () #

Hashable PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

AWSRequest PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Associated Types

type AWSResponse PutCompositeAlarm #

ToHeaders PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

ToPath PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

ToQuery PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

type Rep PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

type Rep PutCompositeAlarm = D1 ('MetaData "PutCompositeAlarm" "Amazonka.CloudWatch.PutCompositeAlarm" "libZSservicesZSamazonka-cloudwatchZSamazonka-cloudwatch" 'False) (C1 ('MetaCons "PutCompositeAlarm'" 'PrefixI 'True) (((S1 ('MetaSel ('Just "alarmDescription") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "oKActions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Text]))) :*: (S1 ('MetaSel ('Just "actionsEnabled") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "insufficientDataActions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Text])))) :*: ((S1 ('MetaSel ('Just "alarmActions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Text])) :*: S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Tag]))) :*: (S1 ('MetaSel ('Just "alarmName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "alarmRule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))
type AWSResponse PutCompositeAlarm Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

newPutCompositeAlarm Source #

Create a value of PutCompositeAlarm with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:alarmDescription:PutCompositeAlarm', putCompositeAlarm_alarmDescription - The description for the composite alarm.

$sel:oKActions:PutCompositeAlarm', putCompositeAlarm_oKActions - The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).

Valid Values: arn:aws:sns:region:account-id:sns-topic-name

$sel:actionsEnabled:PutCompositeAlarm', putCompositeAlarm_actionsEnabled - Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. The default is TRUE.

$sel:insufficientDataActions:PutCompositeAlarm', putCompositeAlarm_insufficientDataActions - 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).

Valid Values: arn:aws:sns:region:account-id:sns-topic-name

$sel:alarmActions:PutCompositeAlarm', putCompositeAlarm_alarmActions - 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).

Valid Values: arn:aws:sns:region:account-id:sns-topic-name | arn:aws:ssm:region:account-id:opsitem:severity

$sel:tags:PutCompositeAlarm', putCompositeAlarm_tags - A list of key-value pairs to associate with the composite alarm. You can associate as many as 50 tags with an alarm.

Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values.

$sel:alarmName:PutCompositeAlarm', putCompositeAlarm_alarmName - The name for the composite alarm. This name must be unique within the Region.

$sel:alarmRule:PutCompositeAlarm', putCompositeAlarm_alarmRule - 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.

Alarm names specified in AlarmRule can be surrounded with double-quotes ("), but do not have to be.

The following are some examples of AlarmRule:

  • ALARM(CPUUtilizationTooHigh) AND ALARM(DiskReadOpsTooHigh) specifies that the composite alarm goes into ALARM state only if both CPUUtilizationTooHigh and DiskReadOpsTooHigh alarms are in ALARM state.
  • ALARM(CPUUtilizationTooHigh) AND NOT ALARM(DeploymentInProgress) specifies that the alarm goes to ALARM state if CPUUtilizationTooHigh is in ALARM state and DeploymentInProgress is not in ALARM state. This example reduces alarm noise during a known deployment window.
  • (ALARM(CPUUtilizationTooHigh) OR ALARM(DiskReadOpsTooHigh)) AND OK(NetworkOutTooHigh) goes into ALARM state if CPUUtilizationTooHigh OR DiskReadOpsTooHigh is in ALARM state, and if NetworkOutTooHigh is in OK state. This provides another example of using a composite alarm to prevent noise. This rule ensures that you are not notified with an alarm action on high CPU or disk usage if a known network problem is also occurring.

The AlarmRule can specify as many as 100 "children" alarms. The AlarmRule expression can have as many as 500 elements. Elements are child alarms, TRUE or FALSE statements, and parentheses.

Request Lenses

putCompositeAlarm_alarmDescription :: Lens' PutCompositeAlarm (Maybe Text) Source #

The description for the composite alarm.

putCompositeAlarm_oKActions :: Lens' PutCompositeAlarm (Maybe [Text]) Source #

The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).

Valid Values: arn:aws:sns:region:account-id:sns-topic-name

putCompositeAlarm_actionsEnabled :: Lens' PutCompositeAlarm (Maybe Bool) Source #

Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. The default is TRUE.

putCompositeAlarm_insufficientDataActions :: Lens' PutCompositeAlarm (Maybe [Text]) Source #

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).

Valid Values: arn:aws:sns:region:account-id:sns-topic-name

putCompositeAlarm_alarmActions :: Lens' PutCompositeAlarm (Maybe [Text]) Source #

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).

Valid Values: arn:aws:sns:region:account-id:sns-topic-name | arn:aws:ssm:region:account-id:opsitem:severity

putCompositeAlarm_tags :: Lens' PutCompositeAlarm (Maybe [Tag]) Source #

A list of key-value pairs to associate with the composite alarm. You can associate as many as 50 tags with an alarm.

Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values.

putCompositeAlarm_alarmName :: Lens' PutCompositeAlarm Text Source #

The name for the composite alarm. This name must be unique within the Region.

putCompositeAlarm_alarmRule :: Lens' PutCompositeAlarm Text Source #

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.

Alarm names specified in AlarmRule can be surrounded with double-quotes ("), but do not have to be.

The following are some examples of AlarmRule:

  • ALARM(CPUUtilizationTooHigh) AND ALARM(DiskReadOpsTooHigh) specifies that the composite alarm goes into ALARM state only if both CPUUtilizationTooHigh and DiskReadOpsTooHigh alarms are in ALARM state.
  • ALARM(CPUUtilizationTooHigh) AND NOT ALARM(DeploymentInProgress) specifies that the alarm goes to ALARM state if CPUUtilizationTooHigh is in ALARM state and DeploymentInProgress is not in ALARM state. This example reduces alarm noise during a known deployment window.
  • (ALARM(CPUUtilizationTooHigh) OR ALARM(DiskReadOpsTooHigh)) AND OK(NetworkOutTooHigh) goes into ALARM state if CPUUtilizationTooHigh OR DiskReadOpsTooHigh is in ALARM state, and if NetworkOutTooHigh is in OK state. This provides another example of using a composite alarm to prevent noise. This rule ensures that you are not notified with an alarm action on high CPU or disk usage if a known network problem is also occurring.

The AlarmRule can specify as many as 100 "children" alarms. The AlarmRule expression can have as many as 500 elements. Elements are child alarms, TRUE or FALSE statements, and parentheses.

Destructuring the Response

data PutCompositeAlarmResponse Source #

See: newPutCompositeAlarmResponse smart constructor.

Instances

Instances details
Eq PutCompositeAlarmResponse Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Read PutCompositeAlarmResponse Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Show PutCompositeAlarmResponse Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Generic PutCompositeAlarmResponse Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

Associated Types

type Rep PutCompositeAlarmResponse :: Type -> Type #

NFData PutCompositeAlarmResponse Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

type Rep PutCompositeAlarmResponse Source # 
Instance details

Defined in Amazonka.CloudWatch.PutCompositeAlarm

type Rep PutCompositeAlarmResponse = D1 ('MetaData "PutCompositeAlarmResponse" "Amazonka.CloudWatch.PutCompositeAlarm" "libZSservicesZSamazonka-cloudwatchZSamazonka-cloudwatch" 'False) (C1 ('MetaCons "PutCompositeAlarmResponse'" 'PrefixI 'False) (U1 :: Type -> Type))

newPutCompositeAlarmResponse :: PutCompositeAlarmResponse Source #

Create a value of PutCompositeAlarmResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.