CloudWatch.ServiceResource.
alarms
¶A collection of Alarm resources.A Alarm Collection will include all resources by default, and extreme caution should be taken when performing actions on all resources.
all
()¶Creates an iterable of all Alarm resources in the collection.
See also: AWS API Documentation
Request Syntax
alarm_iterator = cloudwatch.alarms.all()
cloudwatch.Alarm
)delete
()¶Deletes the specified alarms. You can delete up to 100 alarms in one operation. However, this total can include no more than one composite alarm. For example, you could delete 99 metric alarms and one composite alarms with one operation, but you can't delete two composite alarms with one operation.
In the event of an error, no alarms are deleted.
Note
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.
See also: AWS API Documentation
Request Syntax
response = cloudwatch.alarms.delete()
disable_actions
()¶Disables the actions for the specified alarms. When an alarm's actions are disabled, the alarm actions do not execute when the alarm state changes.
See also: AWS API Documentation
Request Syntax
response = cloudwatch.alarms.disable_actions()
enable_actions
()¶Enables the actions for the specified alarms.
See also: AWS API Documentation
Request Syntax
response = cloudwatch.alarms.enable_actions()
filter
(**kwargs)¶Creates an iterable of all Alarm resources in the collection filtered by kwargs passed to method. A Alarm collection will include all resources by default if no filters are provided, and extreme caution should be taken when performing actions on all resources.
See also: AWS API Documentation
Request Syntax
alarm_iterator = cloudwatch.alarms.filter(
AlarmNames=[
'string',
],
AlarmNamePrefix='string',
AlarmTypes=[
'CompositeAlarm'|'MetricAlarm',
],
ChildrenOfAlarmName='string',
ParentsOfAlarmName='string',
StateValue='OK'|'ALARM'|'INSUFFICIENT_DATA',
ActionPrefix='string',
MaxRecords=123,
NextToken='string'
)
The names of the alarms to retrieve information about.
An alarm name prefix. If you specify this parameter, you receive information about all alarms that have names that start with this prefix.
If this parameter is specified, you cannot specify AlarmNames
.
Use this parameter to specify whether you want the operation to return metric alarms or composite alarms. If you omit this parameter, only metric alarms are returned.
If you use this parameter and specify the name of a composite alarm, the operation returns information about the "children" alarms of the alarm you specify. These are the metric alarms and composite alarms referenced in the AlarmRule
field of the composite alarm that you specify in ChildrenOfAlarmName
. Information about the composite alarm that you name in ChildrenOfAlarmName
is not returned.
If you specify ChildrenOfAlarmName
, you cannot specify any other parameters in the request except for MaxRecords
and NextToken
. If you do so, you receive a validation error.
Note
Only the Alarm Name
, ARN
, StateValue
(OK/ALARM/INSUFFICIENT_DATA), and StateUpdatedTimestamp
information are returned by this operation when you use this parameter. To get complete information about these alarms, perform another DescribeAlarms
operation and specify the parent alarm names in the AlarmNames
parameter.
If you use this parameter and specify the name of a metric or composite alarm, the operation returns information about the "parent" alarms of the alarm you specify. These are the composite alarms that have AlarmRule
parameters that reference the alarm named in ParentsOfAlarmName
. Information about the alarm that you specify in ParentsOfAlarmName
is not returned.
If you specify ParentsOfAlarmName
, you cannot specify any other parameters in the request except for MaxRecords
and NextToken
. If you do so, you receive a validation error.
Note
Only the Alarm Name and ARN are returned by this operation when you use this parameter. To get complete information about these alarms, perform another DescribeAlarms
operation and specify the parent alarm names in the AlarmNames
parameter.
list(cloudwatch.Alarm
)
A list of Alarm resources
limit
(**kwargs)¶Creates an iterable up to a specified amount of Alarm resources in the collection.
See also: AWS API Documentation
Request Syntax
alarm_iterator = cloudwatch.alarms.limit(
count=123
)
cloudwatch.Alarm
)page_size
(**kwargs)¶Creates an iterable of all Alarm resources in the collection, but limits the number of items returned by each service call by the specified amount.
See also: AWS API Documentation
Request Syntax
alarm_iterator = cloudwatch.alarms.page_size(
count=123
)
cloudwatch.Alarm
)