- Reference >
- MongoDB Package Components >
mongotop
mongotop¶
Synopsis¶
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.
See also
For more information about monitoring MongoDB, see Monitoring for MongoDB.
For additional background on various other MongoDB status outputs see:
For an additional utility that provides MongoDB metrics see mongostat.
Options¶
-
mongotop¶
-
--help¶ Returns a basic help and usage text.
-
--verbose,-v¶ Increases the amount of internal reporting returned on the command line. Increase the verbosity with the
-vform by including the option multiple times, (e.g.-vvvvv.)
-
--host<hostname><:port>¶ Specifies a resolvable hostname for the
mongodfrom which you want to export data. By defaultmongotopattempts to connect to a MongoDB process running on the localhost port number27017.Optionally, specify a port number to connect a MongoDB instance running on a port other than
27017.To connect to a replica set, you can specify the replica set seed name, and a seed list of set members, in the following format:
-
--port<port>¶ Specifies the port number, if the MongoDB instance is not running on the standard port. (i.e.
27017) You may also specify a port number using themongotop --hostcommand.
-
--ipv6¶ Enables IPv6 support that allows
mongotopto connect to the MongoDB instance using an IPv6 network. All MongoDB programs and processes, includingmongotop, disable IPv6 support by default.
-
--username<username>,-u<username>¶ Specifies a username to authenticate to the MongoDB instance, if your database requires authentication. Use in conjunction with the
mongotopoption to supply a password.
-
--password<password>,-p<password>¶ Specifies a password to authenticate to the MongoDB instance. Use in conjunction with the
--usernameoption to supply a username.If you specify a
--usernameand do not pass an argument to--password,mongotopwill prompt for a password interactively. If you do not specify a password on the command line,--passwordmust be the last argument specified.
-
--authenticationDatabase<dbname>¶ New in version 2.4.
Specifies the database that holds the user’s (e.g
--username) credentials.By default,
mongotopassumes that the database specified to the--dbargument holds the user’s credentials, unless you specify--authenticationDatabase.See
userSource, system.users Privilege Documents and User Privilege Roles in MongoDB for more information about delegated authentication in MongoDB.
-
--authenticationMechanism<name>¶ New in version 2.4.
Specifies the authentication mechanism. By default, the authentication mechanism is
MONGODB-CR, which is the MongoDB challenge/response authentication mechanism. In MongoDB Enterprise,mongotopalso includes support forGSSAPIto handle Kerberos authentication.See Deploy MongoDB with Kerberos Authentication for more information about Kerberos authentication.
Fields¶
mongotop returns time values specified in milliseconds
(ms.)
mongotop only reports active namespaces or databases,
depending on the --locks option. If you don’t see a database
or collection, it has received no recent activity. You can issue a
simple operation in the mongo shell to generate activity to
affect the output of mongotop.
-
mongotop.ns¶ Contains the database namespace, which combines the database name and collection.
-
mongotop.db¶ New in version 2.2.
Contains the name of the database. The database named
.refers to the global lock, rather than a specific database.This field does not appear unless you have invoked
mongotopwith the--locksoption.
-
mongotop.total¶ Provides the total amount of time that this
mongodspent operating on this namespace.
-
mongotop.read¶ Provides the amount of time that this
mongodspent performing read operations on this namespace.
-
mongotop.write¶ Provides the amount of time that this
mongodspent performing write operations on this namespace.
-
mongotop.<timestamp>¶ Provides a time stamp for the returned data.
Use¶
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.
To force mongotop to return less frequently specify a number, in
seconds at the end of the command. In this example, mongotop will
return every 15 seconds.
This command produces the following output:
To return a mongotop report every 5 minutes, use the
following command:
To report the use of per-database locks, use mongotop --locks,
which produces the following output: