:doc:`Alarm <index>` / Action / describe_history

****************
describe_history
****************



.. py:method:: CloudWatch.Alarm.describe_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 <https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory>`_  


  **Request Syntax**
  ::

    response = alarm.describe_history(
        AlarmContributorId='string',
        AlarmTypes=[
            'CompositeAlarm'|'MetricAlarm',
        ],
        HistoryItemType='ConfigurationUpdate'|'StateUpdate'|'Action'|'AlarmContributorStateUpdate'|'AlarmContributorAction',
        StartDate=datetime(2015, 1, 1),
        EndDate=datetime(2015, 1, 1),
        MaxRecords=123,
        NextToken='string',
        ScanBy='TimestampDescending'|'TimestampAscending'
    )
    
  :type AlarmContributorId: string
  :param AlarmContributorId: 

    The unique identifier of a specific alarm contributor to filter the alarm history results.

    

  
  :type AlarmTypes: list
  :param AlarmTypes: 

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

    

  :type HistoryItemType: string
  :param HistoryItemType: 

    The type of alarm histories to retrieve.

    

  
  :type StartDate: datetime
  :param StartDate: 

    The starting date to retrieve alarm history.

    

  
  :type EndDate: datetime
  :param EndDate: 

    The ending date to retrieve alarm history.

    

  
  :type MaxRecords: integer
  :param MaxRecords: 

    The maximum number of alarm history records to retrieve.

    

  
  :type NextToken: string
  :param NextToken: 

    The token returned by a previous call to indicate that there is more data available.

    

  
  :type ScanBy: string
  :param ScanBy: 

    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.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'AlarmHistoryItems': [
              {
                  'AlarmName': 'string',
                  'AlarmContributorId': 'string',
                  'AlarmType': 'CompositeAlarm'|'MetricAlarm',
                  'Timestamp': datetime(2015, 1, 1),
                  'HistoryItemType': 'ConfigurationUpdate'|'StateUpdate'|'Action'|'AlarmContributorStateUpdate'|'AlarmContributorAction',
                  'HistorySummary': 'string',
                  'HistoryData': 'string',
                  'AlarmContributorAttributes': {
                      'string': '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.

            
          

          - **AlarmContributorId** *(string) --* 

            The unique identifier of the alarm contributor associated with this history item, if applicable.

            
          

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

            
          

          - **AlarmContributorAttributes** *(dict) --* 

            A map of attributes that describe the alarm contributor associated with this history item, providing context about the contributor's characteristics at the time of the event.

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
      
    
      

      - **NextToken** *(string) --* 

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

        
  