Created
January 29, 2010 04:05
-
-
Save mbabineau/289438 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Example code for specifying multiple dimensions in a | |
# query of Amazon EC2 CloudWatch using the boto library. | |
# | |
# Boto may be downloaded here: http://code.google.com/p/boto | |
from datetime import datetime, timedelta | |
from boto import connect_cloudwatch | |
from boto.ec2.cloudwatch.metric import Metric | |
end = datetime.now() | |
start = end - timedelta(hours=24) | |
statistic = 'Average' | |
unit = 'Count' | |
period = 60 | |
m = Metric() | |
m.connection = connect_cloudwatch() | |
m.name = 'HealthyHostCount' | |
m.namespace = "AWS/ELB" | |
m.dimensions = {u'LoadBalancerName': u'example-lb-name', | |
u'AvailabilityZone': u'us-east-1a'} | |
rs = m.query(start, end, statistic, unit, period) | |
print rs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment