Monitoring MongoDB Using CloudWatch
In this post, we’ll see how we can leverage CloudWatch custom metrics to setup monitoring for our MongoDB cluster.
Pre-requisite: We need a running MongoDB replicaset which we’ll set monitoring for. You can follow https://gist.github.com/calvinh8/c99e198ce5df3d8b1f1e42c1b984d7a4 to setup a MongoDB replicaset.
Step 1: Download code given at https://raw.githubusercontent.com/vinycoolguy2015/awslambda/master/mongo_monitoring.py
In the given code, make sure to change the connection string accordingly.