aws / containers-roadmap

This is the public roadmap for AWS container services (ECS, ECR, Fargate, and EKS).
https://aws.amazon.com/about-aws/whats-new/containers/
Other
5.2k stars 316 forks source link

[Fargate] [request]: CloudWatch metric for task exit status #405

Open cmclaughlin opened 5 years ago

cmclaughlin commented 5 years ago

I'd like a metric to report on container exist status. Support for scheduled tasks in Fargate is great, but I need to know when they don't work.

I opened a support request about this and learned ECS events can be used to cobble together a solution:

For this purpose you can use the ecs events [1], specifically the task events [2] that are available for Fargate.

You can use a lambda function to listening for these events and then this function can send them to CloudWatch logs. This document provides more details about how a lambda function can be configured to listen ecs events [3]. Then after having the events in CloudWatch Logs, they can be used to filter the data and create metrics as is done in the following example [4].

Additionally, you can use the Lambda function to directly send the data to populate the metrics directly. In this way you don’t keep the data recorded in CloudWatch Logs. More details about this option can be found here [5].

This request is for Fargate... but perhaps it applies to ECS too(?).

Basically, the recommended solution is a bit complicated and could be fragile. If I'm left to write my own Lambda for this, now I have two things to monitor.


[1] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwe_events.html [2] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwe_events.html#ecs_task_events [3] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwet_handling.html [4] https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CountingLogEventsExample.html [5] https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html

markoilijoski commented 12 months ago

Hi, is there any update on this? @cmclaughlin did u find a workaround for this? Thanks

cmclaughlin commented 11 months ago

I solved this with https://cronitor.io/

costincaraivan commented 9 months ago

+1 to this. It's been 4 years since the original request and Fargate has been out for... 6 years?

It's supposed to be the second simplest AWS serverless computing service outside of Lambda and for some stuff Lambda just isn't usable (for example things that have longer runtimes).

😔