Cloudwatch: list_metrics returns an empty list

364 views
Skip to first unread message

Berco Beute

unread,
Mar 25, 2010, 6:30:57 PM3/25/10
to boto-users
Although I have quite some instances with cloudwatch enabled (and
around 10 Elastic Load Balancers), 'list_metrics' returns an empty
list. It is confusing that this example is different from the one in
the APi:

http://www.elastician.com/2009/05/using-ec2-cloudwatch-in-boto.html

API (which is what I am using):

http://boto.s3.amazonaws.com/ref/ec2.html?highlight=cloudwatch#the-5-minute-how-to-guide

What is the proper way?

Berco

Mitchell Garnaat

unread,
Mar 25, 2010, 6:50:38 PM3/25/10
to boto-...@googlegroups.com
Well, both of the resources you link to start with this basic sequence of calls:

>>> import boto
>>> c = boto.connect_cloudwatch()
>>> metrics = c.list_metrics()


and you are saying that this call returns an empty list for you?

Mitch


--
You received this message because you are subscribed to the Google Groups "boto-users" group.
To post to this group, send email to boto-...@googlegroups.com.
To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.


Berco Beute

unread,
Mar 26, 2010, 5:12:37 AM3/26/10
to boto-users
Yes.
Well, in the first URL example you set the monitoring yourself by hand
(on the EC2Connection):

ec2conn.monitor_instance('i-12345678')

But I expected list_metrics() to display the metrics of existing
cloudwatches as well, not just the ones you create from within boto.
Shouldn't it?

Cheers,
Berco


On Mar 25, 11:50 pm, Mitchell Garnaat <mitch.garn...@gmail.com> wrote:
> Well, both of the resources you link to start with this basic sequence of
> calls:
>
> >>> import boto
> >>> c = boto.connect_cloudwatch()
> >>> metrics = c.list_metrics()
>
> and you are saying that this call returns an empty list for you?
>
> Mitch
>

> On Thu, Mar 25, 2010 at 6:30 PM, Berco Beute <cybe...@gmail.com> wrote:
> > Although I have quite some instances with cloudwatch enabled (and
> > around 10 Elastic Load Balancers), 'list_metrics' returns an empty
> > list. It is confusing that this example is different from the one in
> > the APi:
>
> >http://www.elastician.com/2009/05/using-ec2-cloudwatch-in-boto.html
>
> > API (which is what I am using):
>

> >http://boto.s3.amazonaws.com/ref/ec2.html?highlight=cloudwatch#the-5-...


>
> > What is the proper way?
>
> > Berco
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "boto-users" group.
> > To post to this group, send email to boto-...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > boto-users+...@googlegroups.com<boto-users%2Bunsu...@googlegroups.com>

Mitchell Garnaat

unread,
Mar 26, 2010, 7:26:38 AM3/26/10
to boto-...@googlegroups.com
Yes, it absolutely should.  Let me do some investigation and see if I can reproduce this.

Mitch

To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
Message has been deleted

Berco Beute

unread,
Mar 28, 2010, 9:24:24 AM3/28/10
to boto-users
I suddenly realized it is probably because I am connecting to the
wrong region. The region I should connect to is eu-west-1, which is
not
the default. Now the question becomes how I can connect to cloudwatch
in another region.

Mitchell Garnaat

unread,
Mar 28, 2010, 9:32:40 AM3/28/10
to boto-...@googlegroups.com
Hi -

You should be able to connect to CloudWatch in the eu-west-1 region by specifying that region's endpoint as the host in the constructor for the CloudWatchConnection object like this:

c = CloudWatchConnection(host='https://monitoring.eu-west-1.amazonaws.com')

or 

c = boto.connect_cloudwatch(host='https://monitoring.eu-west-1.amazonaws.com')

This is not very clear in any of the documentation (mine or Amazon's actually) so I'll try to improve that.

Mitch

On Sun, Mar 28, 2010 at 9:22 AM, Berco Beute <cyb...@gmail.com> wrote:
I suddenly realized it is probably because I am connecting to the
right region. The region I ul to connect to is eu-west-1, which is not

the default. Now the question becomes how I can connect to cloudwatch
in another region.

--

Berco Beute

unread,
Mar 28, 2010, 11:04:47 AM3/28/10
to boto-users
Ah! Thanks, indeed, the following works:

c = boto.connect_cloudwatch(host='monitoring.eu-west-1.amazonaws.com',
aws_access_key_id='bla', aws_secret_access_key='bla')

but mind that I didn't include the 'https' protocol for the 'host'
keyword argument.

I am a huge fan of your boto library, but to be honest, the handling
of different regions leaves much to be desired. This is of course due
to the lack of documentation and that the places where and how to
specify the region feels inconsistent. But still, these are minor
issue, overal I am very content with boto.

Cheers,
Berco

Mitchell Garnaat

unread,
Mar 28, 2010, 11:20:40 AM3/28/10
to boto-...@googlegroups.com
Well, to be honest, you could say the same thing about the AWS API's 8^)  It's amazing how difficult it is to try to find all of the endpoints for the different services.  Ideally, all of these endpoints would be provided by a direct request from some main AWS endpoint and that is actually how it works for the main EC2 endpoints.  Unfortunately, all of the others require sifting through dev guides and API docs.  Still, it should be possible to hide that ugliness in the boto layer.

Mitch


--
Reply all
Reply to author
Forward
0 new messages