The mongostat and mongotop utilities
Most of you might find these names similar to two popular Unix commands, iostat
and top
. For MongoDB, mongostat
and mongotop
are two utilities which does pretty much the same job as these two Unix commands do and there is no prize for guessing that these are used to monitor the mongo instance.
Getting ready
In this recipe, we would be simulating some operations on a standalone mongo instance by running a script that would attempt to keep your server busy, and then in another terminal we will run these utilities to monitor the db
instance.
You need to start a standalone server listening to any port for client connections; in this case, we will stick to the default 27017
. If you are not aware how to start a standalone server, refer to Installing single node MongoDB in Chapter 1, Installing and Starting the Server. We also need to download the script KeepServerBusy.js
from Packt site and keep it handy for execution on local drive. Also, it is assumed that the...