Navigation
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.

Build PyMongo Packages with PyMongo C Extensions

Overview

If you are installing PyMongo and the Monitoring agent on systems that do not have C compilers, you can create a .egg package of PyMongo with C extensions to install on your system or systems.

While the C extensions are not required for MMS Monitoring, they significantly improve performance. You must have a C compiler (e.g. gcc) and Python header files installed on your system.

Prerequisites

Before you build PyMongo packages with PyMongo C extensions, these software packages must be available or installed on the target system:

  • Python 2.6+
  • curl to retrieve PyMongo archived file
  • gcc or similar to install a C compiler
  • python-dev or python-devel to install Python C extensions
  • pip to install and uninstall PyMongo
  • pymongo to install the Python driver used by the monitoring agent
  • agent.py to install the MongoDB monitoring agent

The packages distributed in PyPI for Windows include C extensions.

Considerations

The .egg file created with these instructions will only work on systems that resemble the environment on which you built the package. Ensure operating systems, versions of Python, and architecture (i.e. “32” or “64” bit) match.

Commands below use PyMongo version 2.6.3. If the current version is higher, replace 2.6.3 with the current number.

Procedure

1

Install gcc and Python Packages

For Debian and Ubuntu environments, issue this command:

sudo apt-get install build-essential python-dev

For Red Hat, CentOS, and Fedora environments, issue this command:

sudo yum install gcc python-devel python-setuptools python-setuptools-devel
2

Install PyMongo

curl http://pypi.python.org/packages/source/p/pymongo/pymongo-2.6.3.tar.gz > pymongo-2.6.3.tar.gz
3

Extract the PyMongo Files

tar -zxvf pymongo-2.6.3.tar.gz
4

Build the .egg File

cd pymongo-2.6.3
python setup.py bdist_egg

Once built, you can find .egg file in the dist/ sub-directory. The file name will resemble pymongo-2.6.3-py2.7-linux-x86_64.egg but may have a different name depending on your platform and the version of python you use to compile.

5

Install the .egg File on Target System

sudo easy_install pymongo-2.6.2-py2.7-linux-x86_64.egg
6

Install the Monitoring Agent

Copy the .egg file to the target system and issue this command to install the package:

cd mms-agent
nohup python agent.py > /LOG_DIRECTORY/agent.log 2>&1 &

Replace LOG-DIRECTORY with the path to your MongoDB logs.

Next Steps

Once the agent is running and configured, the next step is to deploy the monitoring agent in production.

Also, consider reading the PyMongo documentation.