print fixes for python3
This commit is contained in:
@@ -19,7 +19,7 @@ def describe_alarms(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
client = boto3.client('cloudwatch', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY, region_name=region)
|
||||
|
||||
response = client.describe_alarms()
|
||||
print"### {} Alarms ###" .format(region)
|
||||
print ("### {} Alarms ###" .format(region))
|
||||
for alarm in response['MetricAlarms']:
|
||||
pp.pprint(alarm)
|
||||
print("\n")
|
||||
@@ -29,7 +29,7 @@ def describe_alarms(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print ("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -42,11 +42,11 @@ def describe_alarm_history(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
response = client.describe_alarm_history()
|
||||
#print response
|
||||
if response.get('AlarmHistoryItems') is None:
|
||||
print "{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print ("{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['AlarmHistoryItems']) <= 0:
|
||||
print "[-] DecribeAlarmHistory allowed for {} but no results [-]" .format(region)
|
||||
print ("[-] DecribeAlarmHistory allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} Alarm History ###" .format(region)
|
||||
print ("### {} Alarm History ###" .format(region))
|
||||
for history_item in response['AlarmHistoryItems']:
|
||||
pp.pprint(history_item)
|
||||
print("\n")
|
||||
@@ -56,7 +56,7 @@ def describe_alarm_history(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print ('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print ("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -69,11 +69,11 @@ def list_metrics(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
response = client.list_metrics()
|
||||
#print response
|
||||
if response.get('Metrics') is None:
|
||||
print "{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print ("{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Metrics']) <= 0:
|
||||
print "[-] ListMetrics allowed for {} but no results [-]" .format(region)
|
||||
print ("[-] ListMetrics allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### Listing Metrics for {} ###" .format(region)
|
||||
print ("### Listing Metrics for {} ###" .format(region))
|
||||
for metrics in response['Metrics']:
|
||||
pp.pprint(metrics)
|
||||
print("\n")
|
||||
@@ -83,6 +83,6 @@ def list_metrics(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print ('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print ("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print ("CTRL-C received, exiting...")
|
||||
|
||||
Reference in New Issue
Block a user