CloudWatchClient.describe_alarms
rboto-cloudwatch==0.4.0 · Service index · Types
Model summary (excerpt): Retrieves the specified alarms. You can filter the results by specifying a prefix for the alarm name, the alarm state, or a prefix for any action. To use this operation and return information about composite alarms, you must be signed on with the cloudwatch:DescribeAlarms permission that is scoped to * . You can't return information about composite alarms if your cloudwatch:DescribeAlarms...
Install and imports
from rboto import CloudWatchClient
from collections.abc import Sequence
from rboto_cloudwatch.types import (
AlarmType,
DescribeAlarmsOutput,
StateValue,
)
Signature
async def describe_alarms(
*,
alarm_names: Sequence[str] | None = None,
alarm_name_prefix: str | None = None,
alarm_types: Sequence[AlarmType] | None = None,
children_of_alarm_name: str | None = None,
parents_of_alarm_name: str | None = None,
state_value: StateValue | None = None,
action_prefix: str | None = None,
max_records: int | None = None,
next_token: str | None = None,
) -> DescribeAlarmsOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
alarm_names |
No | The names of the alarms to retrieve information about. |
alarm_name_prefix |
No | 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 . |
alarm_types |
No | Use this parameter to specify whether you want the operation to return metric alarms, composite alarms, or log alarms. If you omit this parameter, only metric alarms are returned, even if composite alarms or log alarms exist in the account. For example, if you omit this parameter or specify MetricAlarms , the operation returns only a list of metric alarms. It does not return any composite... |
children_of_alarm_name |
No | 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.... |
parents_of_alarm_name |
No | 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... |
state_value |
No | Specify this parameter to receive information only about alarms that are currently in the state that you specify. |
action_prefix |
No | Use this parameter to filter the results of the operation to only those alarms that use a certain alarm action. For example, you could specify the ARN of an SNS topic to find all alarms that send notifications to that topic. |
max_records |
No | The maximum number of alarm descriptions to retrieve. |
next_token |
No | The token returned by a previous call to indicate that there is more data available. |
Output
DescribeAlarmsOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
composite_alarms |
list[CompositeAlarmOutput] | None |
Always present | CompositeAlarmOutput |
metric_alarms |
list[MetricAlarmOutput] | None |
Always present | MetricAlarmOutput |
log_alarms |
list[LogAlarmOutput] | None |
Always present | LogAlarmOutput |
next_token |
str | None |
Always present | — |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
AlarmType, DescribeAlarmsOutput, StateValue
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
client.paginators.describe_alarms(...) accepts the same arguments and returns AsyncIterator[DescribeAlarmsOutput]. Direct calls return one page. Pages preserve the Output representation above.
Input cursors: next_token. Page-size argument: max_records.
No output stream.
Waiters
from rboto import WaiterConfig. Calls use this public operation, including configured middleware and native retries. Polling, deadlines and errors.
client.waiters.alarm_exists:
async def alarm_exists(
*,
alarm_names: Sequence[str] | None = None,
alarm_name_prefix: str | None = None,
alarm_types: Sequence[AlarmType] | None = None,
children_of_alarm_name: str | None = None,
parents_of_alarm_name: str | None = None,
state_value: StateValue | None = None,
action_prefix: str | None = None,
max_records: int | None = None,
next_token: str | None = None,
waiter_config: WaiterConfig | None = None,
) -> DescribeAlarmsOutput: ...
Default fixed delay: 5 seconds. Default maximum: 40 polls. No overall timeout unless configured.
Returns the successful polling Output.
| Acceptor index | State | Matcher | Model path | Expected |
|---|---|---|---|---|
| 0 | success | booleanEquals | length(MetricAlarms[]) > |
true |
Acceptors are checked in order. Missing fields or unmatched successful responses continue polling. Unmatched service errors propagate.
client.waiters.composite_alarm_exists:
async def composite_alarm_exists(
*,
alarm_names: Sequence[str] | None = None,
alarm_name_prefix: str | None = None,
alarm_types: Sequence[AlarmType] | None = None,
children_of_alarm_name: str | None = None,
parents_of_alarm_name: str | None = None,
state_value: StateValue | None = None,
action_prefix: str | None = None,
max_records: int | None = None,
next_token: str | None = None,
waiter_config: WaiterConfig | None = None,
) -> DescribeAlarmsOutput: ...
Default fixed delay: 5 seconds. Default maximum: 40 polls. No overall timeout unless configured.
Returns the successful polling Output.
| Acceptor index | State | Matcher | Model path | Expected |
|---|---|---|---|---|
| 0 | success | booleanEquals | length(CompositeAlarms[]) > |
true |
Acceptors are checked in order. Missing fields or unmatched successful responses continue polling. Unmatched service errors propagate.
client.waiters.log_alarm_exists:
async def log_alarm_exists(
*,
alarm_names: Sequence[str] | None = None,
alarm_name_prefix: str | None = None,
alarm_types: Sequence[AlarmType] | None = None,
children_of_alarm_name: str | None = None,
parents_of_alarm_name: str | None = None,
state_value: StateValue | None = None,
action_prefix: str | None = None,
max_records: int | None = None,
next_token: str | None = None,
waiter_config: WaiterConfig | None = None,
) -> DescribeAlarmsOutput: ...
Default fixed delay: 5 seconds. Default maximum: 40 polls. No overall timeout unless configured.
Returns the successful polling Output.
| Acceptor index | State | Matcher | Model path | Expected |
|---|---|---|---|---|
| 0 | success | booleanEquals | length(LogAlarms[]) > |
true |
Acceptors are checked in order. Missing fields or unmatched successful responses continue polling. Unmatched service errors propagate.
Errors
Import from rboto_cloudwatch.exceptions:
Other service failures use the service base error; credential, transport and timeout failures use shared errors.
Example
Complete, type-checked service example. Replace its placeholders and configure credentials before running it.
import asyncio
from rboto import CloudWatchClient
async def main() -> None:
async with CloudWatchClient(region="eu-west-2") as client:
await client.put_metric_data(
namespace="MyApplication",
metric_data=[{
"metric_name": "ProcessedEvents",
"value": 1.0,
"unit": "Count",
"dimensions": [{"name": "Environment", "value": "development"}],
}],
)
async for page in client.paginators.describe_alarms(max_records=20):
for alarm in page.metric_alarms or []:
print(alarm.alarm_name, alarm.state_value)
if __name__ == "__main__":
asyncio.run(main())