Getting mongoStat through the mongoDB Java driver

Is there any way to get mongostat results , for example no. requests / sec, insert / sec, etc. through the java driver. One of the ways I found out is to get server status through a Mongo object like:

db.command("serverStatus")

and then get the general requests that are still running, and then manipulate them to receive requests per second.

Is there any other better way to get this information?

+5
source share
1 answer

You can use the function Db.command("ServerStatus")to obtain server status, and you can continue to poll

+4
source

All Articles