Summary of MongoDB Monitoring methods
1)。 Use serverStatus to monitor in Shell
Use the command after entering the Shell client using the mongo command:
> db.serverStatus ()
Hostnam
> db.serverStatus () .host
Lock information
> db.serverStatus () .locks
Global lock information
> db.serverStatus () .globalLock
Memory information
> db.serverStatus () .mem
Number of connections information
> db.serverStatus () .connections
Additional information
> db.serverStatus () .extra_info
Index statistics
> db.serverStatus () .indexCounters
Background refresh information
> db.serverStatus () .backgroundFlushing
Vernier information
> db.serverStatus () .cursors
Network information
> db.serverStatus () .network
Replica set information
> db.serverStatus () .repl
Operation counter of copy set
> db.serverStatus () .opcountersRepl
Operation counter
> db.serverStatus () .opcounters
Assertion information Asserts
> db.serverStatus () .asserts
WriteBacksQueued
> db.serverStatus () .writeBacksQueued
Persistence (dur)
> db.serverStatus () .dur
Record status information
> db.serverStatus () .recordStats
Working set configuration
> db.serverStatus ({workingSet: 1}) .workingSet
Indicator information metrics
> db.serverStatus () .metrics
To monitor a specific parameter, put the parameter name in db.serverStatus (). And then you can.
2)。 Use mongostat to monitor in Shell
The serverStatus command is static monitoring, and MongoDB provides a dynamic monitoring execution tool, mongostat. Mongostat dynamically outputs some important information provided by serverStatus, once per second. Mongostat is used in the same way as the mongo client, using commands under the mongostat executable:
. / mongostat
If the MongoDB executable Bin directory has been added to the environment variable, use:
Mongostat