This file contains 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
from datetime import timedelta, datetime | |
import math | |
import boto3 | |
cloudwatch = boto3.client('cloudwatch') | |
s3 = boto3.resource('s3') | |
def get_bucket_size(bucket): | |
try: | |
return cloudwatch.get_metric_statistics( |
This file contains 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
#!/bin/sh | |
BUCKET=$1 | |
aws cloudwatch get-metric-statistics --namespace AWS/S3 --start-time 2015-12-07T10:00:00 --end-time 2015-12-08T01:00:00 --period 86400 --statistics Average --region eu-west-1 --metric-name BucketSizeBytes --dimensions Name=BucketName,Value=$BUCKET Name=StorageType,Value=StandardStorage |
This file contains 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/env python | |
import shlex | |
import subprocess | |
def main(): | |
cmd = '/usr/bin/nodetool -h localhost cfstats' | |
p = subprocess.Popen(shlex.split(cmd), stdout = subprocess.PIPE) | |
out = p.communicate()[0] | |
This file contains 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
def _get_role(ip): | |
role = [k for k, v in env.roledefs.iteritems() if ip in v] | |
return role[0] |