Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting mongoStat through mongoDB Java driver

Is there a way to get the results of the mongostat utility such as no. of queries/sec, inserts/sec, etc. through java driver. One way I find out was to get the serverstatus through the Mongo object as:

db.command("serverStatus")

and then get the total queries performed till now and then manipulate it to get queries per second.

Is there any other better way to get this information?

like image 821
aditya_gaur Avatar asked Mar 15 '11 10:03

aditya_gaur


1 Answers

You can use the Db.command("ServerStatus") function to get the Server Status and you can keep polling

like image 64
rm21 Avatar answered Sep 25 '22 03:09

rm21