Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does a CloudWatch request count alarm created via CloudFormation yield "Insufficient Data"?

I am using AWS CloudFormation for my application and am trying to make a request count alarm via a respective template. I can successfully make the request count alarm directly for the Elastic Load Balancer, but the alarm state within Amazon CloudWatch is "insufficient data", when I'm trying to achieve the same via a CloudFormation template.

My ELB JSON is:

"ElasticLoadBalancer": {
  "Type": "AWS::ElasticLoadBalancing::LoadBalancer",
  "Properties": {
    "AvailabilityZones": {
      "Fn::GetAZs": ""
    },
    "Listeners": [
      {
        "LoadBalancerPort": "80",
        "InstancePort": {
          "Ref": "WebServerPort"
        },
        "Protocol": "HTTP"
      }
    ],
    "HealthCheck": {
      "Target": {
        "Fn::Join": [
          "",
          [
            "HTTP:",
            {
              "Ref": "WebServerPort"
            },
            "/"
          ]
        ]
      },
      "HealthyThreshold": "3",
      "UnhealthyThreshold": "5",
      "Interval": "30",
      "Timeout": "5"
    }
  }
},

My alarm JSON is:

"StatisticAlarmLow": {
  "Type": "AWS::CloudWatch::Alarm",
  "Properties": {
    "AlarmDescription": "Alarm if there are too many unhealthy hosts.",
    "MetricName": "RequestCount",
    "Namespace": "AWS/ELB",
    "Statistic": "Sum",
    "Period": "60",
    "EvaluationPeriods": "2",
    "ComparisonOperator": "LessThanThreshold",
    "Threshold": "1500",
    "AlarmActions": [
      {
        "Ref": "WebServerScaleUpPolicy"
      }
    ],
    "Unit": "Count",
    "Dimensions": [
      {
        "Name": "AutoScalingGroupName",
        "Value": {
          "Ref": "WebServerGroup"
        }
      }
    ]
  }
},

"StatisticAlarmHigh": {
  "Type": "AWS::CloudWatch::Alarm",
  "Properties": {
    "AlarmDescription": "Alarm if there are too many unhealthy hosts.",
    "MetricName": "RequestCount",
    "Namespace": "AWS/ELB",
    "Statistic": "Sum",
    "Period": "60",
    "EvaluationPeriods": "2",
    "ComparisonOperator": "GreaterThanThreshold",
    "Threshold": "4000",
    "AlarmActions": [
      {
        "Ref": "WebServerScaleUpPolicy"
      }
    ],
    "Unit": "Count",
    "Dimensions": [
      {
        "Name": "AutoScalingGroupName",
        "Value": {
          "Ref": "WebServerGroup"
        }
      }
    ]
  }
},

From the above it generates the alarm with "insufficient data" as a state. Can anybody tell me what could be the reason? And if there is any sample/example template available for using request count alarm on ELB, it will be appreciated.

like image 320
Anand Soni Avatar asked Apr 07 '12 17:04

Anand Soni


People also ask

Why does CloudWatch alarm say insufficient data?

Because the data points are not successfully being delivered to CloudWatch, the alarm can't retrieve any data points for those evaluation periods. This triggers an INSUFFICIENT_DATA state.

What is sample count in CloudWatch?

SampleCount is the number of data points during the period. Sum is the sum of the values of the all data points collected during the period. Average is the value of Sum/SampleCount during the specified period. Minimum is the lowest value observed during the specified period.

How long does Amazon CloudWatch keep resource data?

You can store your log data in CloudWatch Logs for as long as you want. By default, CloudWatch Logs will store your log data indefinitely. You can change the retention for each Log Group at any time.


1 Answers

The Elastic Load Balancing (ELB) fragment alarm fragment of your Amazon CloudFormation template seems okay, but your Amazon CloudWatch fragment contains a presumably incorrect dimension, insofar it references an AutoScalingGroupName named WebServerGroup - this isn't a supported dimension as per section Dimensions for Elastic Load Balancing Metrics on page Monitoring Your Load Balancer Using CloudWatch, stating Elastic Load Balancing data can be aggregated along any of the following dimensions:

  • LoadBalancerName - Limits the metric data to Amazon EC2 instances that are connected to the specified load balancer.
  • AvailabilityZone - Limits the metric data to load balancers in the specified Availability Zone.
like image 101
Steffen Opel Avatar answered Jun 23 '23 17:06

Steffen Opel