MongoDB is a free and open-source cross-platform document-oriented database program. Use Site24x7 plugins and gain in-depth visibility into the right MongoDB metrics to optimize your data infrastructures.
This document details how to configure the MongoDB plugin and the monitoring metrics for providing in-depth visibility into the performance, availability, and usage stats of MongoDB servers.
MongoDB performance monitoring metrics:
The Various out-of-the-box metrics we support are:
"connections_available" metric counts and records the total number of unused connections available for new clients in your MongoDB setup.
"connections_current" metric counts and records the total number of connections active to the database in your MongoDB setup.
The total amount of heap space in bytes used by the databases in your MongoDB setup is recorded using the metric "heap_usage".
Total open cursors
The metric "cursors_total_open" identifies and records the total number of cursors currently opened by your MongoDB setup for clients.
- Site24x7 MongoDB plugin uses "pymongo" module to get the performance metrics of MongoDB database
- Execute the following command in your server to to install pymongo
pip install pymongo
- Use "pip" to install pymongo
Note: pip is a package management system that is used to install and manage software packages written in Python.
- For CentOS, Fedora, RHEL:
yum install python-develyum install python-pip (or)easy_install pip
- For Debian, Ubuntu:
apt-get -y install python-pip
MongoDB plugin installation:
- Create a directory with the name "mongod", under Site24x7 Linux Agent plugin directory - /opt/site24x7/monagent/plugins/
- Download the file "mongod.py" from our GitHub repository and place it under the "mongod" directory
- Commands to perform the above step:
cd /opt/site24x7/monagent/plugins/mkdir mongodcd mongodwget https://raw.githubusercontent.com/site24x7/plugins/master/mongod/mongod.py
- Once the plugin file is downloaded, the agent will mark it up in the next data collection and you can view it in Site24x7 client
MongoDB plugin configuration:
- By default, the plugin will monitor MongoDB instance that is configured on "localhost"
- The default python path given in the plugin script is #!/usr/bin/python. If you wish to provide an alternate python path, replace the existing one preceded by the shebang character "#!".
- In order to change the monitoring configuration, go to plugins directory and edit the "#Config Section:" in mongod.py file
MongoDB plugin file location - /opt/site24x7agent/monagent/plugins/mongod/mongod.py#Config Section:MONGODB_USERNAME="USER"MONGODB_PWD="PASSWORD"MONGODB_AUTHDB="AUTH"MONGODB_HOST='127.0.0.1'MONGODB_PORT=27017MONGODB_DBSTATS="yes"MONGODB_REPLSET="no"
Monitoring additional metrics:
- To monitor additional metrics, edit the "mongod.py" file and add the new metrics that need monitoring
- Increment the plugin version value in the file "mongod.py" to view the newly added metrics ( For e.g. change the default plugin version from PLUGIN_VERSION = "1" to "PLUGIN_VERSION = "2")
- RabbitMQ plugin - Monitor performance metrics of your RabbitMQ databases
- MySQL plugin - Monitor performance metrics of your MySQL databases
- Samba plugin - Analyze performance of your Samba server
- Nagios plugin - Execute thousands of Nagios plugins in Site24x7 without the need of running a Nagios server
- Out-of-the-box plugins - Monitor your entire app stack with our extensive list of integrations
- Create custom plugins - Create custom Linux and Windows plugins and monitor custom attributes