MongoDB Monitoring
After you have installed, deployed, and enabled the MongoDB service, you must understand how MongoDB is running and check its performance. This way, you can respond well under heavy traffic and ensure MongoDB operates normally.
MongoDB provides two commands, mongostat and mongotop, to monitor how MongoDB is running.
mongostat command
mongostat is a status-monitoring tool that comes with mongodb and is used at the command line. It obtains mongodb's current running status at fixed intervals and outputs it. If you find that the database has suddenly become slow or has other problems, your first course of action should be to use mongostat to check mongo's status.
Start your Mongod service, enter the bin directory under your MongoDB installation directory, and then type the mongostat command, as shown below:
D:\set up\mongodb\bin>mongostat
The output of the above command is as follows:
mongotop command
mongotop is also a built-in tool under mongodb. mongotop provides a way to track a MongoDB instance and see where a large amount of time is spent on reading and writing data. mongotop provides statistics at the level of each collection. By default, mongotop returns values every second.
Start your Mongod service, enter the bin directory under your MongoDB installation directory, and then type the mongotop command, as shown below:
D:\set up\mongodb\bin>mongotop
The output of the above command is as follows:

Example with parameters
E:\mongodb-win32-x86_64-2.2.1\bin>mongotop 10

The 10 after it is the *
E:\mongodb-win32-x86_64-2.2.1\bin>mongotop --locks
To report the use of locks for each database, use mongotop -locks, which produces the following output:

Description of the output result fields:
- ** ns:**
Contains the database namespace, which combines the database name and the collection.
-
db:
Contains the name of the database. A database named . is for global locking, not a specific database.
-
total:
Provides the total amount of time mongod spent working on this namespace.
-
read:
Provides the amount of time mongod spent performing read operations on this namespace.
-
write:
Provides the amount of time mongod spent performing write operations on this namespace.