Unverified Commit 835a518e by Feanil Patel Committed by GitHub

Make it so we update alarms even when they already exist.

parent e81a31fa
...@@ -143,25 +143,22 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold, ...@@ -143,25 +143,22 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
alarm_name = "{}-{} {} queue length over threshold".format(environment, alarm_name = "{}-{} {} queue length over threshold".format(environment,
deploy, deploy,
queue) queue)
if len(cloudwatch.describe_alarms_for_metric(Namespace=namespace,
MetricName=metric_name, print('Creating or updating alarm "{}"'.format(alarm_name))
Dimensions=dimensions) cloudwatch.put_metric_alarm(AlarmName=alarm_name,
['MetricAlarms']) < 1: AlarmDescription=alarm_name,
print('Creating new alarm "{}"'.format(alarm_name)) Namespace=namespace,
cloudwatch.put_metric_alarm(AlarmName=alarm_name, MetricName=metric_name,
AlarmDescription=alarm_name, Dimensions=dimensions,
Namespace=namespace, Period=period,
MetricName=metric_name, EvaluationPeriods=evaluation_periods,
Dimensions=dimensions, TreatMissingData=treat_missing_data,
Period=period, Threshold=queue_threshold,
EvaluationPeriods=evaluation_periods, ComparisonOperator=comparison_operator,
TreatMissingData=treat_missing_data, Statistic=statistic,
Threshold=queue_threshold, InsufficientDataActions=actions,
ComparisonOperator=comparison_operator, OKActions=actions,
Statistic=statistic, AlarmActions=actions)
InsufficientDataActions=actions,
OKActions=actions,
AlarmActions=actions)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment