list_metrics ( $opt )

Returns a list of valid metrics stored for the AWS account owner. Returned metrics can be used with GetMetricStatistics to obtain statistical data for a given metric.

Up to 500 results are returned for any one call. To retrieve further results, use returned NextToken values with subsequent ListMetrics operations.

If you create a metric with the PutMetricData action, allow up to fifteen minutes for the metric to appear in calls to the ListMetrics action.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • Namespace - string - Optional - The namespace to filter against. [Constraints: The value must be between 1 and 255 characters, and must match the following regular expression pattern: [^:].*]
  • MetricName - string - Optional - The name of the metric to filter against.
  • Dimensions - array - Optional - A list of dimensions to filter against.
    • x - array - Optional - This represents a simple array index.
      • Name - string - Required - The dimension name to be matched.
      • Value - string - Optional - The value of the dimension to be matched.

        Specifying a Name without specifying a Value returns all values associated with that Name.

  • 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

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

List up to 500 valid metrics for which there is recorded data available.

// List metrics
$cw = new AmazonCloudWatch();
$response = $cw->list_metrics();

// 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 list_metrics($opt = null)
{
    if (!$opt) $opt = array();
            
    // Optional list + map
    if (isset($opt['Dimensions']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'Dimensions' => $opt['Dimensions']
        ), 'member'));
        unset($opt['Dimensions']);
    }

    return $this->authenticate('ListMetrics', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback