serverStatus

On this page

Definition

serverStatus

The serverStatus command returns a document that provides an overview of the database’s state. Monitoring applications can run this command at a regular interval to collect statistics about the instance.

db.runCommand( { serverStatus: 1 } )

The value (i.e. 1 above) does not affect the operation of the command. The mongo shell provides the db.serverStatus() wrapper for the command.

See also

Much of the output of serverStatus is also displayed dynamically by mongostat. See the mongostat command for more information.

Behavior

By default, serverStatus excludes in its output some content in the repl document.

To include fields that are excluded by default, specify the top-level field and set it to 1 in the command. To exclude fields that are included by default, specify the top-level field and set to 0 in the command.

For example, the following operation suppresses the repl, metrics and locks information in the output.

db.runCommand( { serverStatus: 1, repl: 0, metrics: 0, locks: 0 } )

The following example includes all repl information in the output:

db.runCommand( { serverStatus: 1,  repl: 1 } )

Output

Note

The output fields vary depending on the version of MongoDB, underlying operating system platform, the storage engine, and the kind of node, including mongos, mongod or replica set member.

For the serverStatus output specific to the version of your MongoDB, refer to the appropriate version of the MongoDB Manual.

Instance Information

"host" : <string>,
"advisoryHostFQDNs" : <array>,
"version" : <string>,
"process" : <"mongod"|"mongos">,
"pid" : <num>,
"uptime" : <num>,
"uptimeMillis" : <num>,
"uptimeEstimate" : <num>,
"localTime" : ISODate(""),
host

The system’s hostname. In Unix/Linux systems, this should be the same as the output of the hostname command.

advisoryHostFQDNs

New in version 3.2.

An array of the system’s fully qualified domain names (FQDNs).

version

The MongoDB version of the current MongoDB process.

process

The current MongoDB process. Possible values are: mongos or mongod.

pid

The process id number.

uptime

The number of seconds that the current MongoDB process has been active.

uptimeMillis

The number of milliseconds that the current MongoDB process has been active.

uptimeEstimate

The uptime in seconds as calculated from MongoDB’s internal course-grained time keeping system.

localTime

The ISODate representing the current time, according to the server, in UTC.

asserts

"asserts" : {
   "regular" : <num>,
   "warning" : <num>,
   "msg" : <num>,
   "user" : <num>,
   "rollovers" : <num>
},
asserts

A document that reports on the number of assertions raised since the MongoDB process started. While assert errors are typically uncommon, if there are non-zero values for the asserts, you should check the log file for more information. In many cases, these errors are trivial, but are worth investigating.

asserts. regular

The number of regular assertions raised since the MongoDB process started. Check the log file for more information about these messages.

asserts. warning

The number of warnings raised since the MongoDB process started. Check the log file for more information about these warnings.

asserts. msg

The number of message assertions raised since the MongoDB process started. Check the log file for more information about these messages.

asserts. user

The number of “user asserts” that have occurred since the last time the MongoDB process started. These are errors that user may generate, such as out of disk space or duplicate key. You can prevent these assertions by fixing a problem with your application or deployment. Check the MongoDB log for more information.

asserts. rollovers

The number of times that the rollover counters have rolled over since the last time the MongoDB process started. The counters will rollover to zero after 230 assertions. Use this value to provide context to the other values in the asserts data structure.

backgroundFlushing

"backgroundFlushing" : {
   "flushes" : <num>,
   "total_ms" : <num>,
   "average_ms" : <num>,
   "last_ms" : <num>,
   "last_finished" : ISODate("...")
},

Note

backgroundFlushing information only appears for instances that use the MMAPv1 storage engine.

backgroundFlushing

A document that reports on the mongod process’s periodic writes to disk. Consider these values if you have concerns about write performance and journaling.

backgroundFlushing. flushes

The number of times the database has flushed all writes to disk. This value will grow as database runs for longer periods of time.

backgroundFlushing. total_ms

The total number of milliseconds (ms) that the mongod processes have spent writing (i.e. flushing) data to disk. Because total_ms is an absolute value, consider the flushes and average_ms values to provide context.

backgroundFlushing. average_ms

The average time in milliseconds for each flush to disk, calculated by dividing total_ms by flushes.

The average_ms is more likely to to represent a “normal” time as the value of the flushes increases. However, abnormal data can skew this value. Use the backgroundFlushing.last_ms to check that a high average is not skewed by transient historical issue or a random write distribution.

backgroundFlushing. last_ms

The amount of time, in milliseconds, that the last flush operation took to complete. Use this value to verify that the current performance of the server is in line with the historical data provided by backgroundFlushing.average_ms and backgroundFlushing.total_ms.

backgroundFlushing. last_finished

The timestamp of the last completed flush operation in the ISODate format. If this value is more than a few minutes past your server’s current time and accounting for differences in time zone, restarting the database may result in some data loss.

Also consider ongoing operations that might skew this value by routinely blocking write operations.

connections

"connections" : {
   "current" : <num>,
   "available" : <num>,
   "totalCreated" : NumberLong(<num>)
},
connections

A document that reports on the status of the connections. Use these values to assess the current load and capacity requirements of the server.

connections. current