3

I have setup a bunch of cloudwatch alarms for my service using cloudformation. All my alarms work except for the ELB alarms. They always just show insufficient data. I can go into the console and setup the alarms manually but I want to be able to use cloudformation templates to create everything. I must have an error somewhere in my json for the alarm. Here is one of them:

"ELBHighLatencyAlarm": {
    "Type": "AWS::CloudWatch::Alarm",
    "Properties": {
        "Namespace": "AWS/ELB",
        "AlarmName": { "Fn::Join" : ["", [ { "Ref" : "AWS::StackName"}, "-ELB-ELBHighLatencyAlarm"]]},
        "AlarmDescription":  { "Fn::Join" : ["", [ { "Ref" : "AWS::StackName"}, "-ELB-ELBHighLatencyAlarm"]]},
        "ComparisonOperator": "GreaterThanThreshold",
        "Threshold": "0.5",
        "EvaluationPeriods": "1",
        "Period": "300",
        "MetricName": "Latency",
        "Statistic": "Average",
        "OKActions": [],
        "AlarmActions": [ { "Ref": "PagerDutySNSTopicArn" } ],
        "InsufficientDataActions": [ { "Ref": "PagerDutySNSTopicArn" } ],
        "Dimensions": [ {
            "Name": "ElasticLoadBalancer",
            "Value": { "Ref": "WebServerLoadBalancer" }
        }]
    }
}

Do you see anything wrong with it?

  • 1
    If you still have the issue, can you share a SNS notification? I had a similar issue and fixing some auto-scaling grace time could help.å – Patrice Laramée Apr 28 '16 at 16:42
  • @PatriceLaramée sorry, never found the issue – gprime Apr 28 '16 at 17:48
2

Your "Dimensions" section is not using the proper "Name" value. If you replace:

 "Dimensions": [ {
            "Name": "ElasticLoadBalancer",
            "Value": { "Ref": "WebServerLoadBalancer" }
        }]

with

 "Dimensions": [ {
            "Name": "LoadBalancerName",
            "Value": { "Ref": "WebServerLoadBalancer" }
        }]

you should find that your alarm will work.

| improve this answer | |
3

I can confirm what Dojo said above. Although the wording in the description of the dimensions block makes it seem as though it is not required and strings/values are arbitrary, there is a specific list of names that can be used for each type of service you want to create an alarm for. This list maps the service type to allowable values for in the dimensions block, which makes your alarms work correctly.

It seems to me that the dimensions block is a way of filtering events. So if you wanted to see CPUUtilization for a cluster, you would provide ClusterName. If you want the specific service of a cluster, you would provide 2 entries to the dimensions block. ClusterName and ServiceName.

http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ecs-metricscollected.html

The only difference between the two examples below is the Dimensions.Name field.

Example which will NOT work

"CPUUtilizationScaleInAlarm": {
  "Type": "AWS::CloudWatch::Alarm",
  "Properties": {
    "ActionsEnabled": true,
    "AlarmActions": [
      {
        "Ref": "ESCServiceScaleInPolicy"
      }
    ],
    "AlarmDescription": "Scale in in response to CPUUtilization being low",
    "AlarmName": "CPUUtilizationScaleIn",
    "ComparisonOperator": "LessThanOrEqualToThreshold",
    "Dimensions": [
      {
        "Name": "ECService",
        "Value": "MyAwesomeService"
    ],
    "EvaluationPeriods": 1,
    "MetricName": "CPUUtilization",
    "Namespace": "AWS/ECS",
    "Period": 60,
    "Statistic": "Average",
    "Threshold": 25,
    "Unit": "Percent"
  }
}

Example which WILL work

"CPUUtilizationScaleInAlarm": {
  "Type": "AWS::CloudWatch::Alarm",
  "Properties": {
    "ActionsEnabled": true,
    "AlarmActions": [
      {
        "Ref": "ESCServiceScaleInPolicy"
      }
    ],
    "AlarmDescription": "Scale in in response to CPUUtilization being low",
    "AlarmName": "CPUUtilizationScaleIn",
    "ComparisonOperator": "LessThanOrEqualToThreshold",
    "Dimensions": [
      {
        "Name": "ServiceName",
        "Value": "MyAwesomeService"
    ],
    "EvaluationPeriods": 1,
    "MetricName": "CPUUtilization",
    "Namespace": "AWS/ECS",
    "Period": 60,
    "Statistic": "Average",
    "Threshold": 25,
    "Unit": "Percent"
  }
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.