DEV Community

taragurung
taragurung

Posted on

3

Custom aws cloudwatch monitoring ideas required

Exectation: I am trying to monitor the docker containers running on EC2 instance. For a simple use case, This is what I tried. Getting the number of container running in the machine using the simple bash script given bellow.

I will run this once working fine on cronjob such that it will count the container running and send the data to cloudwatch, every time it runs.

result=$(docker ps --format "{{.Names}}" | wc -l)
 aws cloudwatch put-metric-data --metric-name "Container running $result/6" --unit Count --value "$result" --dimensions Total-Container=$result --namespace System/Docker

It might be the expected cloudwatch behavior but how do I track the latest one in the graph.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more