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 cwcw_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.namespaceprint dataprint '---------'
I have the same question,I have instance in region: 'ap-northeast-1'and it goes with the detailed monitering enabled.But I got nothing returnhere is my ez-testing code<code>import boto.ec2.cloudwatch import datetime cw = boto.ec2.cloudwatch.connect_to_region('ap-northeast-1') metrics = cw.list_metrics(metric_name = 'CPUUtilization') x = 0 z = int() for i in metrics: for j in i.__dict__['dimensions'].values(): if j[0] == <instance name>: z = x x = x + 1end = datetime.datetime.now() start = end - datetime.timedelta(minutes=30) my = ['Average', 'Sum', 'Maximum', 'Minimum']data = metrics[z].query(start_time=start, end_time=end, statistics=my, unit='Percent', period=60) print len(data)</code>my output<output>0</output>
--To view this discussion on the web visit https://groups.google.com/d/msg/boto-users/-/ijwjhTJZJVoJ.
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.