Retrieves history for the specified alarm. Filter alarms by date range or item type. If an
alarm name is not specified, Amazon CloudWatch returns histories for all of the owner’s alarms.
Amazon CloudWatch retains the history of an alarm for two weeks, whether or not you delete the
alarm.
Access
Parameters
Parameter |
Type |
Required |
Description |
$opt
|
array
|
Optional
|
An associative array of parameters that can have the following keys:
AlarmName - string - Optional - The name of the alarm.HistoryItemType - string - Optional - The type of alarm histories to retrieve. [Allowed values: ConfigurationUpdate , StateUpdate , Action ]StartDate - string - Optional - The starting date to retrieve alarm history. May be passed as a number of seconds since UNIX Epoch, or any string compatible with strtotime() .EndDate - string - Optional - The ending date to retrieve alarm history. May be passed as a number of seconds since UNIX Epoch, or any string compatible with strtotime() .MaxRecords - integer - Optional - The maximum number of alarm history records to retrieve.NextToken - string - Optional - The token returned by a previous call to indicate that there is more data available.curlopts - array - Optional - A set of values to pass directly into curl_setopt() , where the key is a pre-defined CURLOPT_* constant.returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests. |
Returns
Examples
Describe all alarm history.
$cw = new AmazonCloudWatch();
$response = $cw->describe_alarm_history();
// Success?
var_dump($response->isOK());
Result:
bool(true)
Describe alarm history matching specific criteria.
$cw = new AmazonCloudWatch();
$response = $cw->describe_alarm_history(array(
'HistoryItemType' => 'Action',
'StartDate' => '1 August 2010',
'EndDate' => '2 August 2010',
'MaxRecords' => 1
));
// Success?
var_dump($response->isOK());
Result:
bool(true)
Related Methods
Source
Method defined in services/cloudwatch.class.php | Toggle source view (18 lines) | View on GitHub
public function describe_alarm_history($opt = null)
{
if (!$opt) $opt = array();
// Optional DateTime
if (isset($opt['StartDate']))
{
$opt['StartDate'] = $this->util->convert_date_to_iso8601($opt['StartDate']);
}
// Optional DateTime
if (isset($opt['EndDate']))
{
$opt['EndDate'] = $this->util->convert_date_to_iso8601($opt['EndDate']);
}
return $this->authenticate('DescribeAlarmHistory', $opt);
}