Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

Monitor MongoDB Windows with SNMP

On this page

  • Overview
  • Considerations
  • Configuration Files
  • Procedure
  • Optional: Run MongoDB as SNMP Master

Note

Enterprise Feature

SNMP is only available in MongoDB Enterprise.

MongoDB Enterprise can provide database metrics via SNMP, in support of centralized data collection and aggregation. This procedure explains the setup and configuration of a exe instance as an SNMP subagent, as well as initializing and testing of SNMP support with MongoDB Enterprise.

Tip

See also:

  • SNMP support is only available in exe. Other MongoDB tools such as exe do not support SNMP.

  • exe does not support the use of SNMP traps.

MongoDB Enterprise contains the following configuration files to support SNMP:

  • MONGOD-MIB.txt:

    The management information base (MIB) file that defines MongoDB's SNMP output.

  • mongod.conf.subagent:

    The configuration file to run exe as the SNMP subagent. This file sets SNMP run-time configuration options, including the AgentX socket to connect to the SNMP master.

  • mongod.conf.master:

    The configuration file to run exe as the SNMP master. This file sets SNMP run-time configuration options.

1

Use the following sequence of commands to move the SNMP configuration files to the SNMP service configuration directory.

First, create the SNMP configuration directory if needed and then, from the installation directory, copy the configuration files to the SNMP service configuration directory:

md C:\snmp\etc\config
copy MONGOD-MIB.txt C:\snmp\etc\config\MONGOD-MIB.txt
copy mongod.conf.subagent C:\snmp\etc\config\mongod.conf

The configuration filename is tool-dependent. For example, when using net-snmp the configuration file is snmpd.conf.

Edit the configuration file to ensure that the communication between the agent (i.e. snmpd or the master) and sub-agent (i.e. MongoDB) uses TCP.

Ensure that the agentXAddress specified in the SNMP configuration file for MongoDB matches the agentXAddress in the SNMP master configuration file.

2

Start exe with the snmp-subagent to send data to the SNMP master.

mongod.exe --snmp-subagent
3

Use snmpwalk to collect data from exe:

Connect an SNMP client to verify the ability to collect SNMP data from MongoDB.

Install the net-snmp package to access the snmpwalk client. net-snmp provides the snmpwalk SNMP client.

snmpwalk -m C:\snmp\etc\config\MONGOD-MIB.txt -v 2c -c mongodb 127.0.0.1:<port> 1.3.6.1.4.1.34601

<port> refers to the port defined by the SNMP master, not the primary port used by exe for client communication.

You can run exe with the snmp-master option for testing purposes. To do this, use the SNMP master configuration file instead of the subagent configuration file. From the directory containing the unpacked MongoDB installation files:

copy mongod.conf.master C:\snmp\etc\config\mongod.conf

Additionally, start exe with the snmp-master option, as in the following:

mongod.exe --snmp-master
←  Monitor MongoDB With SNMP on LinuxTroubleshoot SNMP →