Retrieves alarms with the specified names. If no name is specified, all alarms for the user are
returned. Alarms can be retrieved by using only a prefix for the alarm name, the alarm state,
or a prefix for any action.
Access
Parameters
Parameter |
Type |
Required |
Description |
$opt
|
array
|
Optional
|
An associative array of parameters that can have the following keys:
AlarmNames - string|array - Optional - A list of alarm names to retrieve information for. Pass a string for a single value, or an indexed array for multiple values.AlarmNamePrefix - string - Optional - The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.StateValue - string - Optional - The state value to be used in matching alarms. [Allowed values: OK , ALARM , INSUFFICIENT_DATA ]ActionPrefix - string - Optional - The action name prefix.MaxRecords - integer - Optional - The maximum number of alarm descriptions 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 alarms.
$cw = new AmazonCloudWatch();
$response = $cw->describe_alarms();
// Success?
var_dump($response->isOK());
Result:
bool(true)
Describe a subset of alarms.
$cw = new AmazonCloudWatch();
$response = $cw->describe_alarms(array(
'StateValue' => 'INSUFFICIENT_DATA',
'MaxRecords' => 1
));
// Success?
var_dump($response->isOK());
Result:
bool(true)
Related Methods
Source
Method defined in services/cloudwatch.class.php | Toggle source view (15 lines) | View on GitHub
public function describe_alarms($opt = null)
{
if (!$opt) $opt = array();
// Optional list (non-map)
if (isset($opt['AlarmNames']))
{
$opt = array_merge($opt, CFComplexType::map(array(
'AlarmNames' => (is_array($opt['AlarmNames']) ? $opt['AlarmNames'] : array($opt['AlarmNames']))
), 'member'));
unset($opt['AlarmNames']);
}
return $this->authenticate('DescribeAlarms', $opt);
}