Using mongotop & serverstatus

249 views
Skip to first unread message

rhea ghosh

unread,
Nov 3, 2014, 4:58:40 PM11/3/14
to mongod...@googlegroups.com
I'm trying to monitor my mongodb cluster and look at the data that I have available to me but I'm a little confused by the documentation. 

1. Are mongotop/mongostat returning different things from serverstatus or are they just taking things in server status and outputting them in a different format?

2. If they are just representing pieces of information from serverstatus (which is what I *think* the documentation says) how is mongotop getting the total amount of time mongo has spent per collection reading/writing? In server status I only see the amount of time the db is locked and nothing by collection. 

3. Is there a way to get mongotop output to a file without just letting it run forever. For example I'd like to set up a cron job and I already have one for mongostat to let me easily read the file as a log file but mongostat allows you to limit the number of rows returned so it stops after that number but I don't see any function similar to that for mongotop. Did I miss that or is there another way to get the information?

Will Berkeley

unread,
Nov 5, 2014, 11:47:01 AM11/5/14
to mongod...@googlegroups.com
mongotop and mongostat both user information from serverStatus, but mongotop also gets information from the top command, which is where the extra collection-level information comes from. Presently, there aren't options to allow mongotop to produce a limited amount of output, just the argument to set the number of seconds between returns:

mongotop 15

returns information every 15 seconds. You can run mongotop for a bit and kill it (yourself or programmatically), or use serverStatus and top commands in your own script to gather the information your interested in and write it out to a file, and run that script with cron.

-Will

rhea ghosh

unread,
Nov 6, 2014, 9:48:22 AM11/6/14
to mongod...@googlegroups.com
Thanks this is helpful. Is there a difference between what mongostat returns and what is in serverStatus? I see what you were saying with regards to mongotop how it marries the information from htop and serverStatus but I wasn't sure about mongostat and was curious what the benefit is from using it.

Will Berkeley

unread,
Nov 6, 2014, 10:54:37 AM11/6/14
to mongod...@googlegroups.com
mongostat is a command line program that provides samples every x seconds of some of the most important information from serverStatus. serverStatus returns strictly more information. The benefit of mongostat vs. serverStatus is about convenience of use and presentation. For example, if you have a sharded cluster you can run mongostat --discover against a mongos and mongostat will find, connect to, and display statistics from all of the (non-hidden) nodes in the cluster.

-Will

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/19b29ff9-d015-4d3e-955d-1093ee200141%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages