peterknife / boto

Automatically exported from code.google.com/p/boto
0 stars 0 forks source link

cloudwatch.list_metrics() not returning data #511

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a Instance (no monitoring enabled!)

2. FAIL: Run this script

import boto 
cloudwatch =  boto.connect_cloudwatch()
m = cloudwatch.list_metrics()
--> m will be []

3. OK: Run the script with explicit Region ...

import boto 
cloudwatch =  boto.connect_cloudwatch(host='monitoring.eu-west-1.amazonaws.com')
m = cloudwatch.list_metrics()
--> m will NOT be empty 

What is the expected output? What do you see instead?

Amazon now provides 5 min granularity free monitoring CloudWatch for all 
instances. We want to use this data for monitoring. 

When using boto, boto per default connects to "monitoring.amazonaws.com". The 
query there does not provide data. 

Either Amazon has changes something, or the specification of a region is always 
required. 

What version of the product are you using? On what operating system?

Boto: 2.0b4
OS: Debian Linux Squeeze

Please provide any additional information below.

Our Workaround: 

<....>
region = getRegion(cfg) # this will lookup the region 
                        # from some env var (EC2_REGION) 
                        # and fall back to a default
cw_host="monitoring.%s.amazonaws.com" % region.name
cloudwatch =  boto.connect_cloudwatch(host=cw_host)
<....>

I actually don't know how to fix this right in boto :)

I think the best way would be to add a: 

  region.connect_cloudwatch() 

function to the region object to allow for localized cloudwatch connections.

Robert 

Original issue reported on code.google.com by elconas...@googlemail.com on 11 Apr 2011 at 5:01

GoogleCodeExporter commented 9 years ago
By the way, the command line tools (CloudWatch-1.0.9.5) have the same issue: 

---
mon-list-metrics --region="" | awk '{print $1" "$2}' | sort | uniq -c
.. nothing here ..

mon-list-metrics --region="eu-west-1" | awk '{print $1" "$2}' | sort | uniq -c
     16 CPUUtilization AWS/EC2
     16 DiskReadBytes AWS/EC2
     16 DiskReadOps AWS/EC2
     16 DiskWriteBytes AWS/EC2
     16 DiskWriteOps AWS/EC2
     16 NetworkIn AWS/EC2
     16 NetworkOut AWS/EC2
     10 VolumeIdleTime AWS/EBS
     10 VolumeQueueLength AWS/EBS
      5 VolumeReadBytes AWS/EBS
     10 VolumeReadOps AWS/EBS
      5 VolumeTotalReadTime AWS/EBS
      5 VolumeTotalWriteTime AWS/EBS
      5 VolumeWriteBytes AWS/EBS
     10 VolumeWriteOps AWS/EBS
---

Original comment by elconas...@googlemail.com on 11 Apr 2011 at 5:02

GoogleCodeExporter commented 9 years ago
You do need to connect to the CloudWatch service in the region in which your 
instance is running to access data for that instance.  Apparently your instance 
is running in eu-west-1, therefore you must connect to that region for 
CloudWatch, as well.

Original comment by Mitch.Ga...@gmail.com on 19 Sep 2011 at 10:41