Home > aws, linux, php, Software Engineering, Web > Amazon Web Services : Cloud Watch API

Amazon Web Services : Cloud Watch API

get_metric_statistics :  sdk php 1.5.10

http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#m=AmazonCloudWatch/get_metric_statistics

  1. $cw = new AmazonCloudWatch();
  2. $instance_id1 = “x-xxxxxx”;  // give you instance id for which you want to fetch statistics
  3. $instance_id1 = “x-xxxxxx”;  // give you instance id for which you want to fetch statistics
  4. $opts = array(“Dimensions” => array());
  5. $member = array(“Name” => “InstanceId”,”Value” => $instance_id1);
  6. array_push($opts[“Dimensions”], $member);
  7. $member = array(“Name” => “InstanceId”,”Value” => $instance_id2);
  8. array_push($opts[“Dimensions”], $member);
  9. $data = $cw->get_metric_statistics(‘AWS/EC2’, ‘CPUUtilization’, ‘-1 day’, ‘now’, ‘300’, array(‘Average’), ‘Percent’ ,$opts);
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: