Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
instance monitoring
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Belred  
View profile  
 More options Sep 28 2012, 7:36 pm
From: Belred <bel...@gmail.com>
Date: Fri, 28 Sep 2012 16:36:04 -0700 (PDT)
Local: Fri, Sep 28 2012 7:36 pm
Subject: instance monitoring

I have some instances, auto scaling groups, elastic load balances, SQS,
DynamoDB, S3, etc.  In the AWS Console, I can view many metrics.  such as
CPUUtilization, etc.  According to the boto documentation,  list_metrics()
will only return a metric for which there is data. I then printed each
metric (which there was at least 100), and then queried for each metric
statistics. In every case, the data result that came back was emply.   I
also tried calling get_metric_statistics() and got the same empty data
results.  Am I missing a step?

import boto.ec2.cloudwatch as cw

cw_conn = cw.connect_to_region(AWS_REGION, aws_access_key_id=AWSAccessKeyId,

               aws_secret_access_key=AWSSecretKey)

metrics = cw_conn.list_metrics()

end = datetime.datetime.now()
start = end - datetime.timedelta(days=1)

for m in metrics:
    data = m.query(start, end, m.Statistics)
    print m.name, m.dimensions, m.namespace
    print data
    print '---------'


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
samuelololol  
View profile  
 More options Oct 23 2012, 5:02 am
From: samuelololol <samuel.c...@gmail.com>
Date: Tue, 23 Oct 2012 02:02:53 -0700 (PDT)
Local: Tues, Oct 23 2012 5:02 am
Subject: Re: instance monitoring

end = datetime.datetime.*utc*now()

use UTC time, in my case, it works!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mitchell Garnaat  
View profile  
 More options Oct 23 2012, 8:36 am
From: Mitchell Garnaat <mi...@garnaat.com>
Date: Tue, 23 Oct 2012 05:36:19 -0700
Local: Tues, Oct 23 2012 8:36 am
Subject: Re: [boto-users] Re: instance monitoring

Hi -

Perhaps I'm misunderstanding what you are trying to do but if you want to
find the CPUUtilization metric for a particular instance, the easiest
approach is to filter the metrics based on that.  So, this:

import boto.ec2.cloudwatch
import datetime

cw = boto.ec2.cloudwatch.connect_to_region('ap-northeast-1')

metric = cw.list_metrics(dimensions={'InstanceId': 'i-xxxxxxxx'},
metric_name='CPUUtilization')[0]

The variable metric will now contain the CPUUtilization metric for that
particular instance.

Secondly, your timestamps should be UTC.  So, instead of doing this:

end = datetime.datetime.now()

You should be doing this:

end = datetime.datetime.utcnow()

I have tried this locally and the call to query returns the expected data.

Mitch


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »