Amazon CloudWatch is an easy-to-use web service that provides comprehensive monitoring for Amazon Elastic Compute Cloud (Amazon EC2) and Elastic Load Balancing. For more details information check out the Amazon CloudWatch Developers Guide
Listing Aviable Metrics
listMetrics() returns a list of up to 500 valid metrics for which there is recorded data available to a you and a NextToken string that can be used to query for the next set of results.
1 2 | $ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key');
$return = $ec2_ebs->listMetrics();
|
Return Statistics for a given metric
getMetricStatistics() Returns data for one or more statistics of given a metric.
Note
The maximum number of datapoints that the Amazon CloudWatch service will return in a single GetMetricStatistics request is 1,440. If a request is made that would generate more datapoints than this amount, Amazon CloudWatch will return an error. You can alter your request by narrowing the time range (StartTime, EndTime) or increasing the Period in your single request. You may also get all of the data at the granularity you originally asked for by making multiple requests with adjacent time ranges.
getMetricStatistics() only requires two parameters but it also has four additional parameters that are optional.
1 2 3 4 | $ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key');
$return = $ec2_ebs->getMetricStatistics(
array('MeasureName' => 'NetworkIn',
'Statistics' => array('Average')));
|
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.