Custom aws cloudwatch monitoring ideas required

twitter logo ・1 min read

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.

twitter logo DISCUSS
Classic DEV Post from Apr 12

Health issues you face being a Developer 🏥

You may be a JavaScript Developer or a Ruby Developer, but there is one thing ...

taragurung profile image
Software engineer trying to make the software delivery pipeline better with DEVOPS.