Track MongoDB users operations What is the best way to track operations done on my MongoDB instance?
I want to display a graph with the number of user's operations (insert, update, query etc..) done.

I have read about profiling, but is there a better strategy? How does the MMS do that?
The Cloud Manager (née MMS) documentation includes a list of the Database Commands Used by the Monitoring Agent.

The main command to start with is serverStatus, which includes most metrics specific to a mongod instance (as opposed to replica set or sharded cluster information).

You can run this command via a driver and preview the results with the db.serverStatus() helper in the mongo shell.

Available subsections and output may vary depending on the version and configuration of your MongoDB server.

Interesting sections of serverStatus typically include:


opcounters: insert, query, update, delete, command, getmore
opcounters-repl: opcounters that are the result of replicated operations applied on a secondary
connections: current, available, and total created connections
asserts: number and type of assertions that have been raised since the server started


For more information see:


serverStatus command description
Server Status Output