Mongodb – how to get recordStats in mongodb 3.2

mongodb

I want to monitor accessNotInMemory of mongodb, before I can use

db.adminCommand({'serverStatus': 1})['recordStats']

but according to mongodb doc,

Changed in version 3.0: serverStatus no longer outputs the workingSet, indexCounters, and recordStats sections.

how can I get the recordStats in mongodb 3.2?

Best Answer

I want to monitor accessNotInMemory of mongodb

The database-level recordStats information was specific to the older MMAP storage engine and removed during the MongoDB 3.0 development cycle as part of the work toward collection-level locking and the new storage engine API.

A more general performance indicator you can monitor is db.serverStatus().extra_info.page_faults. This metric is available in MongoDB 3.2 as well as prior versions (2.2+, at least).

Given there are multiple storage engines available in MongoDB 3.0, there are also more detailed per-engine metrics that might be of interest. For example, WiredTiger is the default storage engine as at MongoDB 3.2, and includes a comprehensive set of metrics in the wiredTiger section of serverStatus output.