hostInfo

  • hostInfo

Returns:A document with information about the underlying systemthat the mongod or mongos runs on.Some of the returned fields are only included on someplatforms.

You must run the hostInfo command, which takes noarguments, against the admin database. Consider the followinginvocations of hostInfo:

  1. db.hostInfo()
  2. db.adminCommand( { "hostInfo" : 1 } )

In the mongo shell you can use db.hostInfo()as a helper to access hostInfo. The output ofhostInfo on a Linux system will resemble thefollowing:

  1. {
  2. "system" : {
  3. "currentTime" : ISODate("<timestamp>"),
  4. "hostname" : "<hostname>",
  5. "cpuAddrSize" : <number>,
  6. "memSizeMB" : <number>,
  7. "memLimitMB" : <number>, // Available starting in MongoDB 4.0.9 (and 3.6.13)
  8. "numCores" : <number>,
  9. "cpuArch" : "<identifier>",
  10. "numaEnabled" : <boolean>
  11. },
  12. "os" : {
  13. "type" : "<string>",
  14. "name" : "<string>",
  15. "version" : "<string>"
  16. },
  17. "extra" : {
  18. "versionString" : "<string>",
  19. "libcVersion" : "<string>",
  20. "kernelVersion" : "<string>",
  21. "cpuFrequencyMHz" : "<string>",
  22. "cpuFeatures" : "<string>",
  23. "pageSize" : <number>,
  24. "numPages" : <number>,
  25. "maxOpenFiles" : <number>
  26. },
  27. "ok" : <return>
  28. }

Output

  • hostInfo
  • The document returned by the hostInfo.
  • hostInfo.system
  • An embedded document providing information about the underlyingenvironment of the system running the mongod or mongos
  • hostInfo.system.currentTime
  • A timestamp of the current system time.
  • hostInfo.system.hostname
  • The system name, which should correspond to the output ofhostname -f on Linux systems.
  • hostInfo.system.cpuAddrSize
  • A number reflecting the architecture of the system. Either32 or 64.
  • hostInfo.system.memSizeMB
  • The total amount of system memory (RAM) in megabytes.
  • hostInfo.system.memLimitMB
  • The memory usage limit in megabytes.

For example, running in a container may impose memory limits thatare lower than the total system memory. This memory limit, ratherthan the total system memory, is used as the maximum RAM availableto calculate WiredTiger internal cache.

Available starting in MongoDB 4.0.9 (and 3.6.13)

  • hostInfo.system.numCores
  • The total number of available logical processor cores.
  • hostInfo.system.cpuArch
  • A string that represents the system architecture. Either x86or x86_64.
  • hostInfo.system.numaEnabled
  • A boolean value. false if NUMA is interleaved (i.e. disabled),otherwise true.
  • hostInfo.os
  • An embedded document that contains information about the operatingsystem running the mongod and mongos.
  • hostInfo.os.type
  • A string representing the type of operating system, such asLinux or Windows.
  • hostInfo.os.name
  • If available, returns a display name for the operatingsystem.
  • hostInfo.os.version
  • If available, returns the name of the distribution or operatingsystem.
  • hostInfo.extra
  • An embedded document with extra information about the operating systemand the underlying hardware. The content of theextra embedded document depends on the operatingsystem.
  • hostInfo.extra.cpuString
  • A string containing a human-readable description of the system’sprocessor.

cpuString only appears on macOS systems.

  • hostInfo.extra.versionString
  • A complete string of the operating system version andidentification. On Linux and macOS systems, this contains outputsimilar to uname -a.
  • hostInfo.extra.libcVersion
  • The release of the system libc.

libcVersion only appears on Linuxsystems.

  • hostInfo.extra.kernelVersion
  • The release of the Linux kernel in current use.

kernelVersion only appears on Linuxsystems.

  • hostInfo.extra.alwaysFullSync
  • alwaysFullSync only appears on macOSsystems.
  • hostInfo.extra.nfsAsync
  • nfsAsync only appears on macOSsystems.
  • hostInfo.extra.cpuFrequencyMHz
  • Reports the clock speed of the system’s processor in megahertz.
  • hostInfo.extra.cpuFeatures
  • Reports the processor feature flags. On Linux systems this thesame information that /proc/cpuinfo includes in theflags fields.
  • hostInfo.extra.pageSize
  • Reports the default system page size in bytes.
  • hostInfo.extra.physicalCores
  • Reports the number of physical, non-HyperThreading, cores available on thesystem.

physicalCores only appears on macOS systems.

  • hostInfo.extra.numPages
  • numPages only appears on Linux systems.
  • hostInfo.extra.maxOpenFiles
  • Reports the current system limits on open file handles. SeeUNIX ulimit Settings for more information.

maxOpenFiles only appears on Linuxsystems.

  • hostInfo.extra.scheduler
  • Reports the active I/O scheduler.scheduler only appears on OSX systems.