MongoDB – Commands to Check the Status of MongoDB Database

This article represents different commands which can be used to check the status of MongoDB database on Linux/Ubuntu. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.

MongoDB Status Check Commands

The following represents some of the commands that can be used to check the status of MongoDB database. Note that mongod represents the daemon process of MongDB databass and, primarily, used to manage database access. It is recommended to check the log file (/var/log/mongo/mongo.log) to get details.
Following are some of the commands which can be used to get the status of Mongodb:
  • service mongod status: Displays the status of MongodB service as like the screenshot given below. This command holds good for MongoDB version >= 2.6. Ensure that you are logged in as root. Else use “sudo” command as prefix.
    MongoDB Status Check

    Fig 1. MongoDB Status Check

    If you are having MongoDB version < 2.6, the following command will be applicable:

    service mongodb status

  • systemctl status mongod: Displays the same status of MongoDB service as like above command as shown in figure 1.
  • pgrep mongo: Prints the process ID of running mongo instance. pgrep command looks through the list of running processes and list down the process ids based on name.
  • ps -edaf | grep mongo: Prints the process detail of running mongo instance
  • ps -ax | grep mongo: Returns number of mongod instances that are running
  • nc -zvv localhost 27017: Prints whether connection to mongodb running on port 27017 is succeeded.
  • mongostat: This command provides a real-time view of the database’s performance and status. It shows information such as connections, operations, memory usage, and more.
  • mongotop: This command displays real-time data about the amount of time each MongoDB operation takes to complete, as well as the collection and index involved in each operation.
  • db.stats(): This command is used within the MongoDB shell to retrieve statistics about the current database, including data size, index size, storage size, and the number of objects and indexes.
  • db.serverStatus(): This command provides a detailed overview of the MongoDB server’s current status, including information about connections, memory usage, network activity, replication, and more.


Monitoring the status of your MongoDB database is vital for ensuring its optimal performance. By utilizing commands like ‘service mongod status,’ ‘systemctl status mongod,’ ‘pgrep mongo,’ ‘ps -e | grep mongo,’ ‘mongo,’ ‘mongostat,’ ‘mongotop,’ ‘db.stats(),’ and ‘db.serverStatus(),’ you can effectively check the status, gain insights, and monitor various aspects of your MongoDB deployment. By incorporating these commands into your monitoring routine, you can proactively identify issues, maintain reliability, and optimize the performance of your MongoDB database.

Ajitesh Kumar
Follow me

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog,
Posted in NoSQL. Tagged with , .

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *