aditya_gaur
aditya_gaur

Reputation: 3295

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?

Upvotes: 6

Views: 3118

Answers (1)

rm21
rm21

Reputation: 160

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

Upvotes: 4

Related Questions