describe_alarm_history

describe_alarm_history(**kwargs)

Retrieves the history for the specified alarm. You can filter the results by date range or item type. If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned.

CloudWatch retains the history of an alarm even if you delete the alarm.

To use this operation and return information about a composite alarm, you must be signed on with the cloudwatch:DescribeAlarmHistory permission that is scoped to * . You can't return information about composite alarms if your cloudwatch:DescribeAlarmHistory permission has a narrower scope.

See also: AWS API Documentation

Request Syntax

response = client.describe_alarm_history(
    AlarmName='string',
    AlarmTypes=[
        'CompositeAlarm'|'MetricAlarm',
    ],
    HistoryItemType='ConfigurationUpdate'|'StateUpdate'|'Action',
    StartDate=datetime(2015, 1, 1),
    EndDate=datetime(2015, 1, 1),
    MaxRecords=123,
    NextToken='string',
    ScanBy='TimestampDescending'|'TimestampAscending'
)
Parameters
  • AlarmName (string) -- The name of the alarm.
  • AlarmTypes (list) --

    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.

    • (string) --
  • HistoryItemType (string) -- The type of alarm histories to retrieve.
  • StartDate (datetime) -- The starting date to retrieve alarm history.
  • EndDate (datetime) -- The ending date to retrieve alarm history.
  • MaxRecords (integer) -- The maximum number of alarm history records to retrieve.
  • NextToken (string) -- The token returned by a previous call to indicate that there is more data available.
  • ScanBy (string) -- Specified whether to return the newest or oldest alarm history first. Specify TimestampDescending to have the newest event history returned first, and specify TimestampAscending to have the oldest history returned first.
Return type

dict

Returns

Response Syntax

{
    'AlarmHistoryItems': [
        {
            'AlarmName': 'string',
            'AlarmType': 'CompositeAlarm'|'MetricAlarm',
            'Timestamp': datetime(2015, 1, 1),
            'HistoryItemType': 'ConfigurationUpdate'|'StateUpdate'|'Action',
            'HistorySummary': 'string',
            'HistoryData': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • AlarmHistoryItems (list) --

      The alarm histories, in JSON format.

      • (dict) --

        Represents the history of a specific alarm.

        • AlarmName (string) --

          The descriptive name for the alarm.

        • AlarmType (string) --

          The type of alarm, either metric alarm or composite alarm.

        • Timestamp (datetime) --

          The time stamp for the alarm history item.

        • HistoryItemType (string) --

          The type of alarm history item.

        • HistorySummary (string) --

          A summary of the alarm history, in text format.

        • HistoryData (string) --

          Data about the alarm, in JSON format.

    • NextToken (string) --

      The token that marks the start of the next batch of returned results.

Exceptions

  • CloudWatch.Client.exceptions.InvalidNextToken