Unverified Commit da6e5f3a by Joseph Mulloy Committed by GitHub

Merge pull request #4282 from edx/jdmulloy/ops2545/redis_script_alarm_thresholds

Prevent reconfiguring alarms OPS-2545
parents 81feb823 5893c690
...@@ -100,7 +100,8 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold, ...@@ -100,7 +100,8 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
if len(all_queues) > max_metrics: if len(all_queues) > max_metrics:
# TODO: Use proper logging framework # TODO: Use proper logging framework
print("Warning! Too many metrics, refusing to publish more than {}".format(max_metrics)) print("Warning! Too many metrics, refusing to publish more than {}"
.format(max_metrics))
# Take first max_metrics number of queues from all_queues and remove # Take first max_metrics number of queues from all_queues and remove
# queues that aren't in redis # queues that aren't in redis
...@@ -128,9 +129,14 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold, ...@@ -128,9 +129,14 @@ def check_queues(host, port, environment, deploy, max_metrics, threshold,
treat_missing_data = "missing" treat_missing_data = "missing"
statistic = "Maximum" statistic = "Maximum"
actions = [sns_arn] actions = [sns_arn]
alarm_name = "{} queue length over threshold".format(queue) alarm_name = "{}-{} {} queue length over threshold".format(environment,
deploy,
# Always create/configure alert to keep config up to date queue)
if len(cloudwatch.describe_alarms_for_metric(Namespace=namespace,
MetricName=metric_name,
Dimensions=dimensions)
['MetricAlarms']) < 1:
print('Creating new alarm "{}"'.format(alarm_name))
cloudwatch.put_metric_alarm(AlarmName=alarm_name, cloudwatch.put_metric_alarm(AlarmName=alarm_name,
AlarmDescription=alarm_name, AlarmDescription=alarm_name,
Namespace=namespace, Namespace=namespace,
......
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