From 479dfa21af895060126e66038df1d2521b4a2d2f Mon Sep 17 00:00:00 2001 From: Kamal Gill Date: Thu, 1 Oct 2015 11:11:15 -0700 Subject: [PATCH 1/2] GUI-2126: Remove errant scaling group dimension when adding a scaling policy to allow ELB alarms to work --- eucaconsole/views/scalinggroups.py | 1 - 1 file changed, 1 deletion(-) diff --git a/eucaconsole/views/scalinggroups.py b/eucaconsole/views/scalinggroups.py index 0aeb9260c..542b93594 100644 --- a/eucaconsole/views/scalinggroups.py +++ b/eucaconsole/views/scalinggroups.py @@ -658,7 +658,6 @@ def scalinggroup_policy_create(self): # Attach policy to alarm alarm_name = self.request.params.get('alarm') alarm = self.cloudwatch_conn.describe_alarms(alarm_names=[alarm_name])[0] - alarm.dimensions.update({"AutoScalingGroupName": self.scaling_group.name}) alarm.comparison = alarm._cmp_map.get(alarm.comparison) # See https://github.com/boto/boto/issues/1311 # TODO: Detect if an alarm has 5 scaling policies attached to it and abort accordingly if created_scaling_policy.policy_arn not in alarm.alarm_actions: From b53e7c8e9e086258f5b0d5ed1e9bc41e05a0474c Mon Sep 17 00:00:00 2001 From: Kamal Gill Date: Thu, 1 Oct 2015 16:03:32 -0700 Subject: [PATCH 2/2] GUI-2126: Add the scaling group dimension to the alarm for EC2 metrics when creating a scaling policy --- eucaconsole/views/scalinggroups.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eucaconsole/views/scalinggroups.py b/eucaconsole/views/scalinggroups.py index 542b93594..1f25d73b4 100644 --- a/eucaconsole/views/scalinggroups.py +++ b/eucaconsole/views/scalinggroups.py @@ -658,6 +658,8 @@ def scalinggroup_policy_create(self): # Attach policy to alarm alarm_name = self.request.params.get('alarm') alarm = self.cloudwatch_conn.describe_alarms(alarm_names=[alarm_name])[0] + if 'EC2' in alarm.namespace: + alarm.dimensions.update({"AutoScalingGroupName": self.scaling_group.name}) alarm.comparison = alarm._cmp_map.get(alarm.comparison) # See https://github.com/boto/boto/issues/1311 # TODO: Detect if an alarm has 5 scaling policies attached to it and abort accordingly if created_scaling_policy.policy_arn not in alarm.alarm_actions: