loading...

Custom aws cloudwatch monitoring ideas required

taragrg6 profile image taragurung ・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.

Discussion

pic
Editor guide