Skip to content

Instantly share code, notes, and snippets.

@garlandkr
Created October 16, 2014 20:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garlandkr/f74dbee3df67cb2a896b to your computer and use it in GitHub Desktop.
Save garlandkr/f74dbee3df67cb2a896b to your computer and use it in GitHub Desktop.
Get load_avg from Cloudwatch
import boto
import datetime
cw = boto.connect_cloudwatch()
instance_id = boto.utils.get_instance_metadata()['instance-id']
now = datetime.datetime.utcnow()
start_time = now - datetime.timedelta(days=1)
namespace = "System"
metric_name = "load_avg"
cw.get_metric_statistics(period=60,
start_time=start_time,
end_time=now,
metric_name=metric_name,
namespace=namespace,
statistics=['Maximum'],
dimensions={'InstanceId': [instance_id]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment