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 cout the » Amazon CloudWatch Developers Guide
Example #1 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.
$ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key'); $return = $ec2_ebs->listMetrics();
Example #2 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.
$ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key'); $return = $ec2_ebs->getMetricStatistics(array('MeasureName' => 'NetworkIn', 'Statistics' => array('Average')));