Server Density Blog

Interesting devops tech stuff

Pssst… Server Density v2 is coming soon!

MongoDB Monitoring: mongostat

Written by David Mytton

There are a number of built in tools and commands which can be used to get important information from MongoDB but because it is relatively new, it can be difficult to know what you need to be doing from an operational perspective to ensure that everything runs smoothly.

This is the 5th in a series of 6 posts about MongoDB monitoring based on a talk I gave at the MongoSV 2010 conference. View the series index here.

MongoDB Monitoring dashboard + alerting

We provide a MongoDB monitoring service to keep an eye on the health and performance of your MongoDB database cluster automatically and with alerting. Find out more here.

mongostat

This is a tool that is included with the standard MongoDB distribution package which allows you to view statistics about your database servers in real time.

mongostat screenshot

If you are running mongod locally on its standard 27017 port then you can just start mongostat and it will automatically connect. Otherwise, you can specify one or many hostnames + ports to connect to. The screenshot above shows all the servers in our MongoDB cluster.

Most of the columns are self explanatory (e.g. insert = inserts per second) and noted in the documentation but a few are worth mentioning specifically:

mongostat is useful because it shows what is happening in your cluster right now. This is particularly handy to quickly find out which member of your replica sets is master right now – the final column shows this. If you start seeing slowdowns or suspect a problem with MongoDB, mongostat should be your first point of call to quickly locate where the problem is.

Stay tuned

This is the 5th post in a series of 6 on MongoDB Monitoring. View the full post index and don’t forget to subscribe via RSS or Twitter to be notified of new posts and other cool stuff!

Enjoy this post? You may also like MongoDB Benchmarks

  • Cody Caughlan

    I’m using Mongo 1.6.4 and my mongostat doesnt have as many columns as the above screenshot. I’m lacking: ar | aw, netIn, netOut, set, repl, etc.

    You guys using a forked / custom version of mongostat?

    • http://www.serverdensity.com David Mytton

      These are in the 1.7 version. You probably can’t run it against 1.6 but 1.8 is due out fairly soon if you want to wait for that before upgrading everything (1.7 branch is unstable, not recommended for production).

  • KB

    Hi David,

    Could you please share some statistics on how much data can mongo read, write per second. Also what would be approximate size of the database for 4 GB of data.

    thanks