• English日本語한국어
  • Log inStart now

MongoDB monitoring integration

Our MongoDB integration collects and sends dimensional metrics from MongoDB.

You can view this metric data in pre-built dashboards, create alert policies, and create custom queries and charts.

Dashboard installed through the New Relic MongoDB Monitor quickstart.

To get data from MongoDB instances, our MongoDB integration uses a third-party Prometheus exporter, which exposes Prometheus metrics on the port specified in the configuration. The integration collects these metrics, transforms them into entities, filters them, and then sends them to New Relic.

To install the MongoDB monitoring integration, run through the following steps:

  1. Check requirements.
  2. Install and activate the integration.
  3. Configure the integration.
  4. Find and use data.

Compatibility and requirements

MongoDB versions

Our integration is compatible with MongoDB versions 4.0 to 7.0, Percona Server and MongoDB Atlas M10 or higher.

Supported operating systems

  • Linux Linux

  • Windows Windows

For a comprehensive list of specific Linux and Windows versions, check the table of compatible operating systems.

System requirements

Quick start

New Relic's MongoDB quickstart provides insights including total commands, requests per second, and database size. Our guided install creates a customized CLI command for your environment that downloads and installs the New Relic CLI and the infrastructure agent.

Ready to get started? Click this button to try it out.

Guided install

Our guided install uses the infrastructure agent to set up the MongoDB integration. Not only that, MongoDB free monitoring focuses on standalone instances and replica sets. Data collected on disk utilization, memory, and operation execution times are uploaded periodically.

Install and activate

To install the integration, follow the instructions for your environment:

Other environments

Configuration

To configure the integration, edit the config in the integration's YAML configuration file, mongodb3-config.yml. The configuration is where you can place required login credentials and configure how data is collected. Which options you change depends on your setup and preference.

Setting up your MongoDB

Follow the next steps depending on your environment:

Did this doc help with your installation?

MongoDB instance settings

The following configuration options are available:

Setting

Description

Default

mongodb_cluster_name

User-defined name to uniquely identify the cluster being monitored. Required

N/A

mongodb_uri

MongoDB connection URI. Required

N/A

mongodb_direct_connect

Whether or not a direct connect should be made. Direct connections are not valid if multiple hosts are specified or an SRV URI is used, for example for mongoDB Atlas.

Notice that direct connect should also be set to false if loadBalanced=true is specified either in the connection string or in the DNS entry as it happens in case of Serverless Atlas Deployments.

true

collection_filters

List of comma separated databases.collections. If empty, defaults to all databases and collections

N/A

index_filters

List of comma separated databases.collections to retrieve index stats. If empty, defaults to all indexes

N/A

database_stats

Enable/Disable collection of Database metrics

true

collection_stats

Enable/Disable collection of Collections metrics

true

index_stats

Enable/Disable collection of Index metrics

true

replicaset_stats

Enable/Disable collection of Replica Set metrics

true

top_stats

Enable/Disable collection of Top Admin metrics

true

diagnostic_stats

Enable/Disable collection of Diagnostic metrics

true

exporter_port

Port to expose scrape endpoint on, If this is not provided a random port will be used to launch the exporter

random-port

scrape_timeout

Time until a scrape request times out

5s

Example configurations (mongodb3-config.yml)

Find and use data

Dimensions

The following dimensions are attached to the metrics collected. See the metrics list to check the added dimensions to each metric.

Dimension

Description

assert_type

Type of assertion as per official list.

cl_id

Cluster ID.

cl_role

Cluster Role which can have the following values:

  • mongos - for mongos instances
  • shardsvr - arbiter or regular instances (primary or secondary)
  • empty - for standalone instances and Atlas

collection

Collection name.

concern_type

Concern level for read query operations (available, linearizable, ...). More info.

conn_type

Type or state of database connections (active, available, total, ...). More info.

count_type

Count Type for database global lock state (readers,writers, total). More info.

csr_type

Cursor Type for data open cursors (pinned, noTimeout, total, ...). More info.

database

Database name.

doc_op_type

Operation Type for document access (inserted, deleted, returned, updated). More info.

key_name

Index key name.

legacy_op_type

Operation type for opcounters (delete, getmore, insert, ...). More info.

lock_mode

Mode for data locks (R, W, r, and w). More info.

member_idx

Member name. Normally IP address or DNS name and Port of the member instance.

member_state

Member state in string format from the official status codes.

mongodb_cluster_name

Cluster name set in your configuration file. Note that this dimension applies to all metrics.

op_type

Operation Type for latency (reads, writes, commands). More info.

perf_bucket

Latency buckets WiredTiger read/write performance metrics (bucket1, bucket2, ...). More info.

resource

Resource or type for data locks (Global, Mutex, ParallelBatchWriterMode, ...). More info.

rs_nm

Replicaset name.

rs_state

Replicaset status. An integer representing the replica status following the official status codes.

txn_rw

Concurrent transactions type for WiredTiger storage engine (write, read). More info.

Metric data

These are the 3 entities created: MONGODB_INSTANCE, MONGODB_DATABASE, and MONGODB_COLLECTION.

The following dimensional metrics are captured scraping the exporter and linked to the entity MONGODB_INSTANCE:

The following dimensional metrics are captured scraping the exporter and linked to the entity MONGODB_COLLECTION:

The following dimensional metrics are captured scraping the exporter and linked to the entity MONGODB_DATABASE:

Migrate from the legacy version

If you're using the legacy version we encourage you to test this new version. See the migration page for guidance.

Check the source code

This integration is open source software. This means you can browse its source code and send improvements, or create your own fork and build it.

Moreover, this integration leverages a Prometheus exporter created by the community.

Troubleshooting

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.