This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Test Ops Manager Monitoring

On this page


The following procedure creates a MongoDB replica set and sets up a database populated with random data for use in testing an Ops Manager installation. Create the replica set on a separate machine from Ops Manager.

These instructions create the replica set on a server running RHEL 6+ or Amazon Linux. The procedure installs all the members to one server.



Increase each server’s default ulimit settings.

If you are installing to RHEL, check whether the /etc/security/limits.d directory contains the 90-nproc.conf file. If the file exists, remove it. (The 90-nproc.conf file overrides limits.conf.) Issue the following command to remove the file:

sudo rm /etc/security/limits.d/90-nproc.conf

For more information, see UNIX ulimit Settings in the MongoDB manual.


Install MongoDB on each server.

First, set up a repository definition by issuing the following command:

echo "[mongodb-org-3.0]
name=MongoDB Repository
enabled=1" | sudo tee -a /etc/yum.repos.d/mongodb-org-3.0.repo

Second, install MongoDB by issuing the following command:

sudo yum install -y mongodb-org mongodb-org-shell

Create the data directories for the replica set.

Create a data directory for each replica set member and set mongod.mongod as each data directory’s owner.

For example, the following command creates the directory /data and then creates a data directory for each member of the replica set. You can use different directory names:

sudo mkdir -p /data /data/mdb1 /data/mdb2 /data/mdb3

The following command sets mongod.mongod as owner of the new directories:

sudo chown mongod:mongod /data /data/mdb1 /data/mdb2 /data/mdb3

Start a separate MongoDB instance for each replica set member.

Start each mongod instance on its own dedicated port number and with the data directory you created in the last step. For each instance, specify mongod as the user. Start each instance with the replSet command-line option specifying the name of the replica set.

For example, the following three commands start three members of a new replica set named rs0:

sudo -u mongod mongod --port 27017 --dbpath /data/mdb1 --replSet rs0 --logpath /data/mdb1/mongodb.log --fork

sudo -u mongod mongod --port 27018 --dbpath /data/mdb2 --replSet rs0 --logpath /data/mdb2/mongodb.log --fork

sudo -u mongod mongod --port 27019 --dbpath /data/mdb3 --replSet rs0 --logpath /data/mdb3/mongodb.log --fork

Connect to one of the members.

For example, the following command connects to the member running on port 27017:

mongo --port 27017

Initiate the replica set and add members.

In the mongo shell, issue the rs.initiate() and rs.add() methods, as shown in the following example. Replace the hostnames in the example with the hostnames of your servers:


Verify the replica set configuration.

Issue the rs.conf() method and verify that the members array lists the three members:


Add data to the replica set.

Issue the following for loop to create a collection titled testData and populate it with 25,000 documents, each with an _id field and a field x set to a random string.

for (var i = 1; i <= 25000; i++) {
  db.testData.insert( { x : Math.random().toString(36).substr(2, 15) } );

Confirm data entry.

After the script completes, you can view a document in the testData collection by issuing the following:


To confirm that the script inserted 25,000 documents into the collection, issue the following:


Open the Ops Manager home page in a web browser and register the first user.

The first user created for Ops Manager is automatically assigned the Global Owner role.

Enter the following URL in a web browser, where <ip_address> is the IP address of the server:


Click the Register link and enter information for the new Global Owner user. When you finish, you are logged into the Ops Manager Application as that user. For more information on creating and managing users, see Manage Ops Manager Users.


Set up monitoring for the replica set.

If you have installed the Backup Daemon, click the Get Started button for Backup and follow the instructions. This will set up both monitoring and backup. Otherwise click the Get Started button for Monitoring and follow instructions.

When prompted to add a host, enter the hostname and port of one of the replica set members in the form <hostname>:<port>. For example:

When you finish the instructions, Ops Manager is running and monitoring the replica set.