def get_ebs_volumes(instance): try: volumes = json.load(file('/tmp/ebs-%s.json' % instance, 'r')) return volumes except: pass url = 'https://amazinghorse.simplegeo.com:4430/aws/ec2/%s/instance/%s' % ( region, instance) auth = 'Basic %s' % conf('amazinghorse_auth').encode('base64').rstrip('\n') req = urllib2.Request(url, headers={ 'Authorization': auth, }) resp = urllib2.urlopen(req) server = json.loads(resp.read()) volumes = [] for mountpoint, volume in server['block_devices'].items(): if not volume.startswith('ebs:'): continue volume = volume.split(':', 1)[1] mountpoint = mountpoint.rsplit('/', 1)[1] volumes.append((mountpoint, volume)) json.dump(volumes, file('/tmp/ebs-%s.json' % instance, 'w')) return volumes
def get_ebs_volumes(instance): try: volumes = json.load(file('/tmp/ebs-%s.json' % instance, 'r')) return volumes except: pass url = 'https://amazinghorse.simplegeo.com:4430/aws/ec2/%s/instance/%s' % (region, instance) auth = 'Basic %s' % conf('amazinghorse_auth').encode('base64').rstrip('\n') req = urllib2.Request(url, headers={ 'Authorization': auth, }) resp = urllib2.urlopen(req) server = json.loads(resp.read()) volumes = [] for mountpoint, volume in server['block_devices'].items(): if not volume.startswith('ebs:'): continue volume = volume.split(':', 1)[1] mountpoint = mountpoint.rsplit('/', 1)[1] volumes.append((mountpoint, volume)) json.dump(volumes, file('/tmp/ebs-%s.json' % instance, 'w')) return volumes
from decimal import Decimal import simplejson as json from urllib import urlopen from time import time import urllib2 import socket import dewpoint.aws from metartg import conf, clustohttp region = urllib2.urlopen(urllib2.Request('http://169.254.169.254/latest/meta-data/placement/availability-zone')).read()[:-1] clusto = clustohttp.ClustoProxy('http://clusto.simplegeo.com/api') awscreds = conf('aws') cloudwatch = dewpoint.aws.AWSProxy( key=awscreds['key'], secret=awscreds['secret'], version='2010-08-01', baseurl='http://monitoring.%s.amazonaws.com' % region) def get_ebs_volumes(instance): try: volumes = json.load(file('/tmp/ebs-%s.json' % instance, 'r')) return volumes except: pass url = 'https://amazinghorse.simplegeo.com:4430/aws/ec2/%s/instance/%s' % (region, instance) auth = 'Basic %s' % conf('amazinghorse_auth').encode('base64').rstrip('\n') req = urllib2.Request(url, headers={
import simplejson as json from urllib import urlopen from time import time import urllib2 import socket import dewpoint.aws from metartg import conf, clustohttp region = urllib2.urlopen( urllib2.Request( 'http://169.254.169.254/latest/meta-data/placement/availability-zone') ).read()[:-1] clusto = clustohttp.ClustoProxy('http://clusto.simplegeo.com/api') awscreds = conf('aws') cloudwatch = dewpoint.aws.AWSProxy( key=awscreds['key'], secret=awscreds['secret'], version='2010-08-01', baseurl='http://monitoring.%s.amazonaws.com' % region) def get_ebs_volumes(instance): try: volumes = json.load(file('/tmp/ebs-%s.json' % instance, 'r')) return volumes except: pass url = 'https://amazinghorse.simplegeo.com:4430/aws/ec2/%s/instance/%s' % (