Mongo Db monitoring with mongotop command
mongotop provides a method to track the amount of time
a MongoDB instance spends reading and writing data. mongotop provides
statistics on a per-collection level. By default, mongotop returns
values every second.
Mongotop Options
--help, -h |Returns information on the options and use
of mongotop.
--verbose, -v |Increases the amount of internal
reporting returned on standard output or in log files. Increase the verbosity
with the -v form by including the option multiple times, (e.g. -vvvvv.)
--quiet |Runs the mongotop in a quiet mode that
attempts to limit the amount of output. This option suppresses:
- output
from database
commands
- replication
activity
- connection
accepted events
- connection
closed events
--version|Returns the mongotop release number.
Fields in mongotop
mongotop.ns -- Contains the database namespace, which combines the
database name and collection.
mongotop.db -- Contains the name of the database. Refers to the
global lock, rather than a specific database. This field does not appear unless
you have invoked mongotop with the --locks option.
mongotop.total -- Provides the total amount of time that this
mongod spent operating on this namespace.
mongotop.read -- Provides the amount of time that this mongod spent
performing read operations on this namespace.
mongotop.write -- Provides the amount of time that this mongod
spent performing write operations on this namespace.
mongotop.<timestamp> -- Provides a time stamp for the
returned data.
Syntax :
By default mongotop connects to the MongoDB instance running on the localhost
port 27017.However, mongotop can optionally connect to remote mongod instances. See the
mongotop options for more information.
mongotop -- mongotop will return every second.
mongotop 15 -- mongotop will return every 15 seconds.
Mongo Db monitoring with mongostat command
The mongostat utility provides a quick overview of
the status of a currently running mongod or mongosinstance. mongostat is functionally similar to
the UNIX/Linux file system utility vmstat, but provides data regarding mongod and mongos instances.
Mongostat Options
--help, -h | Returns
information on the options and use of mongostat.
--verbose, -v | Increases the amount of internal reporting
returned on standard output or in log files. Increase the verbosity with the -v form
by including the option multiple times, (e.g. -vvvvv.)
--discover | Discovers and reports on
statistics from all members of a replica
set or sharded
cluster. When connected to any member of a replica set, --discover all
non-hidden
members of the replica set. When connected to a mongos, mongostat will return data from all shards in
the cluster. If a replica set provides a shard in the sharded cluster, mongostat will
report on non-hidden members of that replica set
.—all | Configures mongostat to
return all optional fields.
<sleeptime> | The final argument is the
length of time, in seconds, that mongostat waits in between calls. By
defaultmongostat returns one call every second.mongostat returns
values that reflect the operations over a 1 second period. For values of<sleeptime> greater
than 1, mongostat averages data to reflect average operations per
second.
--rowcount <number>, -n | Controls
the number of rows to output. Use in conjunction with the sleeptime argument
to control the duration of a mongostat operation.Unless --rowcount is
specified, mongostat will return an infinite number of rows (e.g.
value of 0.)
--noheaders | Disables the output of
column or field names.
mongostat outputs the following fields:
inserts -- Number of objects inserted into the database per second. If
followed by an asterisk (e.g. *), the datum refers to a replicated operation.
query -- Number of query operations per second.
update -- Number of update operations per second.
delete -- Number of delete operations per second.
getmore -- Number of get more (i.e. cursor batch) operations
per second.
command -- Number of commands per second. On slave and
secondary systems, mongostat presents two values separated by a pipe character
(e.g. |), in the form of local|replicated commands.
flushes -- Number of fsync operations per second.
mapped -- Total amount of data mapped in MB. This is the total
data size at the time of the last mongostat call.
size -- Amount of (virtual) memory in megabytes used by the
process at the time of the last mongostat call.
res -- Amount of (resident) memory in megabytes used by the
process at the time of the last mongostat call.
faults -- Number of page faults per second.
locked -- The percent of time in a global write lock.
locked db -- The percent of time in the per-database
context-specific lock. mongostat will report the database that has spent the
most time since the last mongostat call with a write lock.
(This value represents the amount of time that the listed database spent in a
locked state combined with the time that the mongod spent in the global lock.
Because of this, and the sampling method, you may see some values greater than
100%.)
idx miss -- The percent of index access attempts that required
a page fault to load a btree node.
qr -- The length of the queue of clients waiting to read data
from the MongoDB instance.
qw -- The length of the queue of clients waiting to write data
from the MongoDB instance.
ar -- The number of active clients performing read operations.
aw -- The number of active clients performing write
operations.
netIn -- The amount of network traffic, in bytes, received by
the MongoDB instance.
(This includes
traffic from mongostat itself.)
netOut -- The amount of network traffic, in bytes, sent by the
MongoDB instance.
(This
includes traffic from mongostat itself.)
conn -- The total number of open connections.
set -- The name, if applicable, of the replica set.
repl -- The replication status of the node.
Value
Replication Type
M
master
SEC secondary
REC
recovering
UNK unknown
SLV slave
Syntax :
mongostat --rowcount 20 1
mongostat --rowcount 20
mongostat -n 20 1
mongostat -n 20