Howard
Howard

Reputation: 19805

How to log dimension like AWS CloudWatch bundled metric

enter image description here

Can anyone explain how to use the AWS PHP SDK to log the metric in the style like the above screen.

I use the following PHP code but the select menu is showing "ELB: AvaliabiltyZone", how to make it show "Aggregated by AvaliabiltyZone"? What is the logic used here?

$response = $cw->put_metric_data("ELB", array(  
    array(  
        "MetricName" => "Latency",  
        "Dimensions" => array(  
            array("Name" => "AvaliabiltyZone"  , "Value" => "us-east-1c")
        ),  
        "Timestamp" => "now",  
        "Value"     => 1,  
        "Unit"      => "None"  
    ),  
));  

Upvotes: 7

Views: 1148

Answers (2)

Saurabh Chandra Patel
Saurabh Chandra Patel

Reputation: 13586

$cw = new AmazonCloudWatch(); 
$cw->set_region('monitoring.'.$region.'amazonaws.com');

$res1  =  $CW->put_metric_data('Sys/RDS' ,
             array(array('MetricName'  => 'Uptime' ,
                         'Dimensions'  => array(array('Name'  => 'AvaliabiltyZone',
                                                      'Value' => 'us-east-1c')),
                         'Value'       => $Uptime,
                         'Unit'        => 'Seconds')));

Click Here

Upvotes: 0

Honk der Hase
Honk der Hase

Reputation: 2488

AvaliabiltyZone

You misspelled "AvailabilityZone"

This maybe won't answer the question, but it might fix some things...

Upvotes: 3

Related Questions