This version of the documentation is archived and no longer supported.

Use MongoDB with SNMP Monitoring

New in version 2.2.

Subscriber Only Feature

This feature is only available in the Subscriber Edition of MongoDB.

This document outlines the use and operation of MongoDB’s SNMP extension, which is is only available in the MongoDB Subscriber Edition.


Install MongoDB Subscriber Edition

The MongoDB Subscriber Edition, is available on four platforms. For more information, see MongoDB Subscriber Edition.

Included Files

The Subscriber Edition packages contain the following files:

  • MONGO-MIB.txt:

    The MIB file that describes the data (i.e. schema) for MongoDB’s SNMP output

  • mongod.conf:

    The SNMP configuration file for reading the SNMP output of MongoDB. The SNMP configures the community names, permissions, access controls, etc.

Required Packages

To use SNMP, you must install several prerequisites. The names of the packages vary by distribution and are as follows:

  • Ubuntu 11.04 requires libssl0.9.8, snmp-mibs-downloader, snmp, and snmpd. Issue a command such as the following to install these packages:

    sudo apt-get install libssl0.9.8 snmp snmpd snmp-mibs-downloader
  • Red Hat Enterprise Linux 6.x series and Amazon Linux AMI require libssl, net-snmp, net-snmp-libs, and net-snmp-utils. Issue a command such as the following to install these packages:

    sudo yum install libssl net-snmp net-snmp-libs net-snmp-utils
  • SUSE Enterprise Linux requires libopenssl0_9_8, libsnmp15, slessp1-libsnmp15, and snmp-mibs. Issue a command such as the following to install these packages:

    sudo zypper install libopenssl0_9_8 libsnmp15 slessp1-libsnmp15 snmp-mibs

Configure SNMP

Install MIB Configuration Files

Ensure that the MIB directory, at /usr/share/snmp/mibs exists. If not, issue the following command:

sudo mkdir -p /usr/share/snmp/mibs

Use the following command to create a symbolic link:

sudo ln -s [/path/to/mongodb/distribution/]MONGO-MIB.txt /usr/share/snmp/mibs/

Replace [/path/to/mongodb/distribution/] with the path to your MONGO-MIB.txt configuration file.

Copy the mongod.conf file into the /etc/snmp directory with the following command:

cp mongod.conf /etc/snmp/mongod.conf

Start Up

You can control the Subscriber Edition of MongoDB using default or custom or control scripts, just as you can any other mongod:

Use the following command to view all SNMP options available in your MongoDB:

mongod --help | grep snmp

The above command should return the following output:

Module snmp options:
  --snmp-subagent       run snmp subagent
  --snmp-master         run snmp as master

Ensure that the following directories exist:

  • /data/db/ (This is the path where MongoDB stores the data files.)
  • /var/log/mongodb/ (This is the path where MongoDB writes the log output.)

If they do not, issue the following command:

mkdir -p /var/log/mongodb/ /data/db/

Start the mongod instance with the following command:

mongod --snmp-master --port 3001 --fork --dbpath /data/db/  --logpath /var/log/mongodb/1.log

Optionally, you can set these options in a configuration file.

To check if mongod is running with SNMP support, issue the following command:

ps -ef | grep 'mongod --snmp'

The command should return output that includes the following line. This indicates that the proper mongod instance is running:

systemuser 31415 10260  0 Jul13 pts/16   00:00:00 mongod --snmp-master --port 3001 # [...]


Check for the snmp agent process listening on port 1161 with the following command:

sudo lsof -i :1161

which return the following output:

mongod  9238 sysadmin   10u  IPv4  96469      0t0  UDP localhost:health-polling

Similarly, this command:

netstat -an | grep 1161

should return the following output:

udp        0      0    *

Run snmpwalk Locally

snmpwalk provides tools for retrieving and parsing the SNMP data according to the MIB. If you installed all of the required packages above, your system will have snmpwalk.

Issue the following command to collect data from mongod using SNMP:

snmpwalk -m MONGO-MIB -v 2c -c mongodb

You may also choose to specify the path to the MIB file:

snmpwalk -m /usr/share/snmp/mibs/MONGO-MIB -v 2c -c mongodb

Use this command only to ensure that you can retrieve and validate SNMP data from MongoDB.


Always check the logs for errors if something does not run as expected, see the log at /var/log/mongodb/1.log. The presence of the following line indicates that the mongod cannot read the /etc/snmp/mongod.conf file:

[SNMPAgent] warning: error starting SNMPAgent as master err:1