Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to accurately report running task count in AWS Cloudwatch from AWS ECS

I have a simple Cloudwatch dashboard to monitor the running task count in a simple ECS cluster. AWS provides this documentation which is exactly what I want. The problem is it doesn't accurately reflect on my dashboard.

Often my desired service count is total of 3: 1 django task and 2 celery task. Most of the time this is reflected correctly in the small dashboard, but not always, and it's driving me a little crazy :\

Current configuration is by-the-books. I'm using ServiceName,ClusterName dimensions, CPUUtilization as the metric, Sample Count for the statistic and 1 minute for the period. This is how AWS says I should do it.

Yet I see this on my dashboard: https://imgur.com/fbBjThi

Looking directly at ECS, however, I have only 1 django and 2 celery tasks running. The Cloudfront dashboard appears to be miscalculating by doubling, even tripling sometimes the sample count value.

Even from Cloudfront when I edit this particular widget, the correct task count is displayed: https://imgur.com/oZfWDyQ

It seems like Cloudfront is getting more than one sample count in the 1 minute period, so I've tried reducing the period to 30 seconds, but that didn't seem to help.

Is 1 minute, as suggested by AWS documentation, the proper period? If not, what is the proper period?

like image 1000
bluescores Avatar asked Dec 20 '17 13:12

bluescores


1 Answers

CloudWatch, "Add Metric Graph", and select your "Graphed Metrics". But before you click on "Create widget", go to "Graph Options", where you see the Widget type as Number, make sure you select "Latest value".

like image 146
tothemario Avatar answered Nov 15 '22 09:11

tothemario