MongoDB Monitoring

MongoDB monitoring involves real-time tracking and analysis of MongoDB performance to ensure efficient database operations and optimization.

Gain visibility into the performance of your MongoDB and MongoDB Atlas databases with Site24x7's ready-to-install MongoDB monitoring plugin integrations. Leverage our MongoDB monitoring tool to gain insights into the availability and health of your MongoDB databases to stay ahead of issues and bottlenecks affecting them.

Add your first server monitoring plugin for free and each subsequent plugin is just $1 per month.

Start 30-day free trial Try now, sign up in 30 seconds
MongoDB Monitoring

MongoDB performance monitoring with Site24x7

Ensure the availability and optimal performance of your MongoDB and MongoDB Atlas database servers, and fix issues before they start affecting end users.

Get insights on critical MongoDB performance metrics

Use key metrics—including memory usage, connections, and replication status—to pinpoint areas impacting MongoDB performance.

Stay updated with instant alerts

Get instant notifications every time values cross pre-defined threshold limits and swiftly take preventative or recovery measures.

Remediate incidents with event-driven IT automation

Set up automated workflows to take corrective measures in MongoDB when pre-defined threshold breaches occur.

Create custom dashboards

Assemble data from different parts of your infrastructure with drag-and-drop widgets and build personalized dashboard views.

BLOG

Navigate memory management challenges in MongoDB

Read about common memory-related issues in MongoDB, their causes and impact, and how you can leverage Site24x7 to identify and resolve them.

Get started with Site24x7's MongoDB monitoring tool

  • Supported Platforms:
  • Python Version:
    2.7 & above
  • Linux Agent Version:
    15.0.0 & above

Performance Metrics

MongoDB performance metrics

You can track the following metrics with the MongoDB monitoring plugin:

Name Description
memory_resident The amount of memory currently used by the database process
memory_virtual The amount of virtual memory used by the mongod process
memory_mapped The amount of mapped memory by the database
connections_current The number of connections to the database server from clients
connections_available The number of unused available incoming connections the database can provide
heap_usage The total size in bytes of heap space used by the database process
page_faults The number of page faults per second that require disk operations
seconds_since_lastflush The amount of time since the last flush operation took to complete
last_flush_length The amount of time that the last flush operation took to complete
flush_length_avrg The average amount of time that the overall flush operation took to complete
cursors_total_open The number of cursors that MongoDB is maintaining for clients
replSet_setName The name of the current replica set, if applicable
replSet_isMaster The Boolean value that reports whether the node is writable
replSet_isSecondary A Boolean value that indicates that the current member is a secondary member of a replica set
replSet_isArbiter A Boolean value that indicates that the current instance is an arbiter
replSet_myState The state of the replica set
MongoDB Atlas performance metrics

You can track the following metrics with the MongoDB Atlas monitoring plugin:

Name Description
analytics_nodes The number of analytics nodes in the region
clustertype The type of the cluster
disksize The capacity (in gigabytes) of the host's root volume
electable_nodes The number of electable nodes in the region
maxinstance_size The maximum instance size to which your cluster can automatically scale
mininstanc_size The minimum instance size to which your cluster can automatically scale
mongodb_majorversion The major version of MongoDB the cluster runs
mongodb_version The version of MongoDB the cluster runs
mongo_uri_updated Timestamp in date and time format in UTC when the connection string was last updated
name The name of the cluster to be retrieved
numshards A positive integer that specifies the number of shards for a sharded cluster
pitenabled A flag that indicates if the cluster uses Continuous Cloud Backups
priority Election priority of the region
provider_backup_enabled A flag that indicates if the cluster uses Cloud Backups for backups
providername The cloud service provider on which Atlas provisioned the hosts
readonly_nodes The number of read-only nodes in the region
replication_factor The number of replica set members
rootcert_type Certificate Authority that MongoDB Atlas clusters use
srvaddress The connection string for connecting to the Atlas cluster
statename The current state of the cluster
zonename The name of the zone

Setup

Quick installation

If you're using Linux servers, use the MongoDB plugin installer that checks the prerequisites and installs the plugin with a bash script. You don't need to manually set up the plugin if you're using the installer.

Execute the command below in the terminal to run the installer and follow the instructions displayed on-screen:
wget https://raw.githubusercontent.com/site24x7/plugins/master/mongoDB/installer/Site24x7MongoDBPluginInstaller.sh && sudo bash Site24x7MongoDBPluginInstaller.sh

Standard installation

If you're not using Linux servers or want to install the plugin manually, follow the steps below.

Prerequisites

Ensure you meet the following requirements before installing the plugin:

  • A Site24x7 account. If you don't have one, sign up here for free.
  • Download and install the Site24x7 server monitoring agent (Linux | Windows) in the network or on the specific host where the MongoDB instance is running.
  • Ensure you have Python 3 or a higher version installed in your server.

    If pymongo not installed, follow the steps below to install it.

    For Linux:

    Execute the following command in your server to install it:

    pip3 install pymongo

    Note: Install a compatible version of pymongo for your existing Python version:

    Python Version Reference link of compatible pymongo versions
    Python 3 https://www.mongodb.com/docs/drivers/pymongo/#python-3-compatibility
    Python 2 https://www.mongodb.com/docs/drivers/pymongo/#python-2-compatibility
  • Create a MongoDB user with clusterMonitor role, which will be used to fetch performance metrics from MongoDB.

Ensure you meet the following requirements before installing the plugin:

  • A Site24x7 account. If you don't have one, sign up here for free.
  • Download and install the Site24x7 server monitoring agent (Linux | Windows) on the server where you have access to MongoDB Atlas.
  • Ensure you have Python 3 or a higher version installed in your server.
  • Ensure that the pymongo module is installed.

If pymongo not installed, follow the steps below to install it.

For Linux:

Execute the following command in your server to install it:

pip3 install pymongo

Installation

  • Create a folder named mongoDB.
  • Download the mongoDB.py and the mongoDB.cfg files from our Github repository and place them in the mongoDB folder.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/mongoDB/mongoDB.py && sed -i "1s|^.*|#! $(which python3)|" mongoDB.py
    wget https://raw.githubusercontent.com/site24x7/plugins/master/mongoDB/mongoDB.cfg
  • To verify if the plugin is working, execute the command below with appropriate arguments to check for a valid JSON output:
    python3 mongoDB.py --host "ip_address" --port "port_number" --username "username" --password "password" --dbname "dbname" --authdb "authdb" --tls "False"
  • Add the appropriate configurations in mongoDB.cfg file:
    [mongo_db]
    host ="localhost"
    port ="27017"
    username ="None"
    password ="None"
    dbname ="mydatabase"
    tls="False"
    tlscertificatekeyfile="None"
    tlscertificatekeyfilepassword="None"
    tlsallowinvalidcertificates="True"
  • Follow the steps in this article to learn how to run the Python script on a Windows server. You don't need to do this for Linux.
  • Move the mongoDB to the Site24x7 server monitoring plugin directory.

    For Linux: /opt/site24x7/monagent/plugins/

    For Windows: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\plugins\

The agent will automatically execute the plugin within five minutes and send performance data to the Site24x7 data center.

To view performance charts and set thresholds for the various performance metrics:

  • Log in to Site24x7.
  • Navigate to Server > Plugin Integrations
  • Click the required monitor.
  • Create a folder named mongodb_atlas.
  • Download the mongodb_atlas.py and the mongodb_atlas.cfg files from our Github repository and place them in the mongodb_atlas folder.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/mongodb_atlas/mongodb_atlas.py && sed -i "1s|^.*|#! $(which python3)|" mongodb_atlas.py
    wget https://raw.githubusercontent.com/site24x7/plugins/master/mongodb_atlas/mongodb_atlas.cfg
  • Add the following configuration in mongodb_atlas.cfg file:
    [mongo_db_atlas]
    mongo_connect_string =<mongodb connection string>
    dbname=<mongodb database name>
  • To verify if the plugin is working, execute the command below with appropriate arguments to check for a valid JSON output:
    python3 mongodb_atlas.py --mongo_connect_string <mongodb connection string> --dbname <monogdb database name>
  • Follow the steps in this article to learn how to run the python script on a Windows server. You don't need to do this for Linux.
  • Move the mongodb_atlas folder to the Site24x7 server monitoring plugin directory.

    For Linux: /opt/site24x7/monagent/plugins/

    For Windows: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\plugins\

The agent will automatically execute the plugin within five minutes and send performance data to the Site24x7 data center.

To view performance charts and set thresholds for the various performance metrics:

  • Log in to Site24x7.
  • Navigate to Plugins > click the required monitor.

Plugin Contribution

Feel free to contribute to our existing plugin and come up with suggestions or feedback on our Community.

  • Supported Platforms:
  • Python Version: 2.7 & above
  • Linux Agent Version:15.0.0 & above

Over 13,000 customers trust Site24x7

Brand logos of our various customers

Check out our 100+ plugin integrations, or build your own

Choose from our list of more than 100 ready-to-use plugins and monitor your full stack of applications across web servers, databases, load balancers, and more.

See all plugin integrations

FAQs on MongoDB monitoring

MongoDB is an open-source, document-oriented NoSQL database that is built to store, retrieve, and manage huge amounts of data. As opposed to relational SQL databases that store data in the form of tables, MongoDB is a non-relational NoSQL database that stores data as flexible, JSON-like documents. This makes MongoDB highly scalable and suitable to be used across multiple systems for data aggregation and retrieval.

MongoDB Atlas is a fully managed cloud-native database that helps businesses deploy and run MongoDB in the cloud. It offers all the features of MongoDB along with high flexibility and scalability, as well as automating database administration tasks.

Monitoring MongoDB is crucial for ensuring optimal performance, detecting potential issues, and maintaining data integrity. It helps in identifying bottlenecks, tracking usage patterns, and preventing downtime by monitoring metrics like heap usage, connections available, page faults, and resident memory, ensuring efficient and reliable operation of MongoDB databases.