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.
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.
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.
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.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With