File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Monitoring/auto-add-cw-alarms Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 8484import getopt
8585import sys
8686import time
87+ import json
8788
8889################################################################################
8990# This function adds the SSD Utilization CloudWatch alarm.
@@ -218,7 +219,8 @@ def getAlarmThresholdTagValue(fsx, arn):
218219 except botocore .exceptions .ClientError as e :
219220 if e .response ['Error' ]['Code' ] == 'ResourceNotFound' :
220221 return (100 ) # Return 100 so we don't try to create an alarm.
221- elif e .response ['Error' ]['Code' ] == 'TooManyRequestsException' or e .response ['Error' ]['Code' ] == 'ThrottlingException' :
222+
223+ if e .response ['Error' ]['Code' ] == 'TooManyRequestsException' or e .response ['Error' ]['Code' ] == 'ThrottlingException' :
222224 sleep = sleep * 2
223225 if sleep > 5 :
224226 raise e
@@ -256,11 +258,11 @@ def getSSDAlarmThresholdTagValue(tags):
256258################################################################################
257259def getFileSystemId (alarm ):
258260
259- for metric in alarm ['Metrics' ]:
260- if metric ["Id" ] == "m1" :
261- for dim in metric ['MetricStat' ]['Metric' ]['Dimensions' ]:
262- if dim ['Name' ] == 'FileSystemId' :
263- return dim ['Value' ]
261+ for metric in alarm ['Metrics' ]:
262+ if metric ["Id" ] == "m1" :
263+ for dim in metric ['MetricStat' ]['Metric' ]['Dimensions' ]:
264+ if dim ['Name' ] == 'FileSystemId' :
265+ return dim ['Value' ]
264266 return None
265267
266268################################################################################
You can’t perform that action at this time.
0 commit comments