2014년 12월 11일 목요일

Using mongotop & serverstatus

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?



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.



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.



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.


댓글 없음:

댓글 쓰기