MongoStat using java driver

480 views
Skip to first unread message

Aditya_gaur

unread,
Mar 11, 2011, 9:11:53 AM3/11/11
to mongodb-user
Please tell me how do we get the mongostats using the java driver.

Scott Hernandez

unread,
Mar 11, 2011, 10:13:24 AM3/11/11
to mongod...@googlegroups.com
The mongostat program is written in c++ and doesn't use java. You can
look at the mongostat program and do the same thing in java if you
like.

https://github.com/mongodb/mongo/blob/master/tools/stat.cpp

On Fri, Mar 11, 2011 at 6:11 AM, Aditya_gaur <agau...@gmail.com> wrote:
> Please tell me how do we get the mongostats using the java driver.
>

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

Aditya_gaur

unread,
Mar 12, 2011, 11:08:54 PM3/12/11
to mongodb-user
Thanks for replying. I know that mongostats is written in c++. The
thing is I want to get the results of the mongostat utility through
java i.e. I want to know the inserts/sec, queries/sec etc.

On Mar 11, 8:13 pm, Scott Hernandez <scotthernan...@gmail.com> wrote:
> The mongostat program is written in c++ and doesn't usejava. You can
> look at the mongostat program and do the same thing injavaif you
> like.
>
> https://github.com/mongodb/mongo/blob/master/tools/stat.cpp

Scott Hernandez

unread,
Mar 12, 2011, 11:15:54 PM3/12/11
to mongod...@googlegroups.com
If you look at the code you will see it runs the serverStatus command;
then it displays deltas from those counters.

https://github.com/mongodb/mongo/blob/master/tools/stat.cpp#L489

That is why I said you can do the same thing in java if you like :)

Aditya_gaur

unread,
Mar 13, 2011, 3:47:39 PM3/13/11
to mongodb-user
Thanks...for the explanation. Now hopefully I'll be able to do.

On Mar 13, 9:15 am, Scott Hernandez <scotthernan...@gmail.com> wrote:
> If you look at the code you will see it runs the serverStatus command;
> then it displays deltas from those counters.
>
> https://github.com/mongodb/mongo/blob/master/tools/stat.cpp#L489
>
> That is why I said you can do the same thing injavaif you like :)
>
> On Sat, Mar 12, 2011 at 8:08 PM, Aditya_gaur <agaur...@gmail.com> wrote:
> > Thanks for replying. I know thatmongostatsis written in c++. The
> > thing is I want to get the results of the mongostat utility through
> >javai.e. I want to know the inserts/sec, queries/sec etc.

Xiaohui Ni

unread,
Apr 9, 2015, 3:10:06 PM4/9/15
to mongod...@googlegroups.com, agau...@gmail.com
I cannot open the https://github.com/mongodb/mongo/blob/master/tools/stat.cpp,

where is the file location now?

Stephen Steneker

unread,
Apr 9, 2015, 5:25:28 PM4/9/15
to mongod...@googlegroups.com
Hi,

Please start a new thread rather than replying to 4-year old ones :).

The command line tools were rewritten in Go for MongoDB 3.0 and moved to their own repository.

The current source for mongostat is:

If you're looking to query specific metrics in Java, it might be better to ask that as a new question.

Regards,
Stephen
Reply all
Reply to author
Forward
0 new messages