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

1

9

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://i.sstatic.net/XiT2o.jpg

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://i.sstatic.net/QKoRc.jpg

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?

Appetizer answered 20/12, 2017 at 13:39 Comment(1)
You need to set the dashboard time frame (top right corner) to one hour, then it should show the correct amount. When you increase the time span, the period for the different statistics increases as well which is why the wrong amount of services is shown. Unfortunately, we have not found a way to display the correct amount for other periods as well.Ushijima
W
3

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".

Worm answered 15/5, 2020 at 23:25 Comment(1)
This is working for "number" type widgets, what about "line" widgets? the history of my service task count will be wrong.Pileum

© 2022 - 2024 — McMap. All rights reserved.