Grafana Cloud

MongoDB Atlas integration for Grafana Cloud

MongoDB Atlas is a fully managed cloud database service that provides a scalable, secure, and flexible platform for hosting and managing MongoDB databases. This integration for Grafana Cloud allows users to collect metrics for monitoring a MongoDB Atlas project containing any number of clustered database deployments.

Metrics include connections, operations, deadlocks, memory usage, election counts, sharding statistics, and network metrics. These are used to provide valuable visualizations for clusters, replica sets, and individual nodes.

This integration supports MongoDB 4.4+ and MongoDB Atlas cluster levels M10+.

This integration includes 12 useful alerts and 4 pre-built dashboards to help monitor and visualize MongoDB Atlas metrics.

Before you begin

In order for this integration to work, you must configure your MongoDB Atlas project to use the provided Prometheus integration. Please note that only MongoDB Atlas M10 and above clusters have access to the Prometheus integration.

Begin by following the steps found here to activate the Prometheus integration. Follow this guide until you have made basic auth credentials for the Prometheus integration and the MongoDB Atlas UI has generated a scrape config for Prometheus. Make note of the username and password you created, and navigate to your MongoDB Atlas project’s settings page and record the project ID.

Please note that while following the steps to activate the Prometheus integration, you only need to worry about the basic auth credentials that get made. The rest of the configuration for the Prometheus integration can be disregarded.

After making the basic auth credentials, navigate to your MongoDB Atlas project settings page and record the project ID.

Next navigate to the “Network Access” section of the MongoDB Atlas project you are targeting. Add the agent bound outbound IP address of the machine running the agent to list of whitelisted IPs.

Install MongoDB Atlas integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find MongoDB Atlas and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send MongoDB Atlas metrics to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your MongoDB Atlas setup.

Configuration snippets for Grafana Alloy

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your MongoDB Atlas instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced metrics snippets

discovery.http "metrics_integrations_integrations_mongodb_atlas" {
	basic_auth {
		username = "<prom_username>"
		password = "<prom_password>"
	follow_redirects = true
	enable_http2     = true
	refresh_interval = "1m0s"
	url              = "<group_id>/discovery"

prometheus.scrape "metrics_integrations_integrations_mongodb_atlas" {
	targets         = discovery.http.metrics_integrations_integrations_mongodb_atlas.targets
	forward_to      = [prometheus.remote_write.metrics_service.receiver]
	job_name        = "integrations/mongodb-atlas"
	scrape_interval = "10s"
	scheme          = "https"

	basic_auth {
		username = "<prom_username>"
		password = "<prom_password>"

To monitor your MongoDB Atlas server, you must use a discovery.http component to discover your MongoDB Atlas Prometheus endpoint and apply appropriate labels, followed by a prometheus.scrape component to scrape it.

Configure the following properties within each discovery.http component:

  • <prom_username> and <prom_password>: change these arguments to match the username and password created when activating the Prometheus integration.
  • url: The address to your MongoDB Atlas Prometheus metrics endpoint.
  • <group_id>: change the <group_id> placeholder within the url argument to match the project id for the project the Prometheus integration was activated for.

If you have multiple MongoDB Atlas servers to scrape, configure one discovery.http for each and scrape them by including each under targets within the prometheus.scrape component.

Grafana Agent static configuration (deprecated)

The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.


The MongoDB Atlas integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • MongoDB Atlas cluster overview
  • MongoDB Atlas election overview
  • MongoDB Atlas operations overview
  • MongoDB Atlas performance overview

MongoDB Atlas cluster overview 1 (tables)

MongoDB Atlas cluster overview 1 (tables)

MongoDB Atlas cluster overview 2 (operations)

MongoDB Atlas cluster overview 2 (operations)

MongoDB Atlas operations overview 1 (operations)

MongoDB Atlas operations overview 1 (operations)


The MongoDB Atlas integration includes the following useful alerts:

MongoDBAtlasHighNumberOfCollectionExclusiveDeadlocksWarning: There is a high number of collection exclusive deadlocks occurring.
MongoDBAtlasHighNumberOfCollectionIntentExclusiveDeadlocksWarning: There is a high number of collection intent-exclusive deadlocks occurring.
MongoDBAtlasHighNumberOfCollectionSharedDeadlocksWarning: There is a high number of collection shared deadlocks occurring.
MongoDBAtlasHighNumberOfCollectionIntentSharedDeadlocksWarning: There is a high number of collection intent-shared deadlocks occurring.
MongoDBAtlasHighNumberOfDatabaseExclusiveDeadlocksWarning: There is a high number of database exclusive deadlocks occurring.
MongoDBAtlasHighNumberOfDatabaseIntentExclusiveDeadlocksWarning: There is a high number of database intent-exclusive deadlocks occurring.
MongoDBAtlasHighNumberOfDatabaseSharedDeadlocksWarning: There is a high number of database shared deadlocks occurring.
MongoDBAtlasHighNumberOfDatabaseIntentSharedDeadlocksWarning: There is a high number of database intent-shared deadlocks occurring.
MongoDBAtlasHighNumberOfSlowNetworkRequestsWarning: There is a high number of slow network requests.
MongoDBAtlasDiskSpaceLowWarning: Hardware is running out of disk space.
MongoDBAtlasSlowHardwareIOWarning: Read and write I/Os are taking too long to complete.
MongoDBAtlasHighNumberOfTimeoutElectionsWarning: There is a high number of elections being called due to the primary node timing out.


The most important metrics provided by the MongoDB Atlas integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

  • hardware_disk_metrics_disk_space_free_bytes
  • hardware_disk_metrics_disk_space_used_bytes
  • hardware_disk_metrics_read_count
  • hardware_disk_metrics_read_time_milliseconds
  • hardware_disk_metrics_write_count
  • hardware_disk_metrics_write_time_milliseconds
  • hardware_system_cpu_irq_milliseconds
  • mongodb_connections_active
  • mongodb_connections_current
  • mongodb_connections_totalCreated
  • mongodb_electionMetrics_averageCatchUpOps
  • mongodb_electionMetrics_catchUpTakeover_called
  • mongodb_electionMetrics_catchUpTakeover_successful
  • mongodb_electionMetrics_electionTimeout_called
  • mongodb_electionMetrics_electionTimeout_successful
  • mongodb_electionMetrics_numCatchUps
  • mongodb_electionMetrics_numCatchUpsFailedWithError
  • mongodb_electionMetrics_numCatchUpsSkipped
  • mongodb_electionMetrics_numCatchUpsSucceeded
  • mongodb_electionMetrics_numCatchUpsTimedOut
  • mongodb_electionMetrics_priorityTakeover_called
  • mongodb_electionMetrics_priorityTakeover_successful
  • mongodb_electionMetrics_stepUpCmd_called
  • mongodb_electionMetrics_stepUpCmd_successful
  • mongodb_globalLock_activeClients_readers
  • mongodb_globalLock_activeClients_writers
  • mongodb_globalLock_currentQueue_readers
  • mongodb_globalLock_currentQueue_writers
  • mongodb_locks_Collection_acquireWaitCount_R
  • mongodb_locks_Collection_acquireWaitCount_W
  • mongodb_locks_Collection_acquireWaitCount_r
  • mongodb_locks_Collection_acquireWaitCount_w
  • mongodb_locks_Collection_deadlockCount_R
  • mongodb_locks_Collection_deadlockCount_W
  • mongodb_locks_Collection_deadlockCount_r
  • mongodb_locks_Collection_deadlockCount_w
  • mongodb_locks_Collection_timeAcquiringMicros_R
  • mongodb_locks_Collection_timeAcquiringMicros_W
  • mongodb_locks_Collection_timeAcquiringMicros_r
  • mongodb_locks_Collection_timeAcquiringMicros_w
  • mongodb_locks_Database_acquireWaitCount_R
  • mongodb_locks_Database_acquireWaitCount_W
  • mongodb_locks_Database_acquireWaitCount_r
  • mongodb_locks_Database_acquireWaitCount_w
  • mongodb_locks_Database_deadlockCount_R
  • mongodb_locks_Database_deadlockCount_W
  • mongodb_locks_Database_deadlockCount_r
  • mongodb_locks_Database_deadlockCount_w
  • mongodb_locks_Database_timeAcquiringMicros_R
  • mongodb_locks_Database_timeAcquiringMicros_W
  • mongodb_locks_Database_timeAcquiringMicros_r
  • mongodb_locks_Database_timeAcquiringMicros_w
  • mongodb_mem_resident
  • mongodb_mem_virtual
  • mongodb_network_bytesIn
  • mongodb_network_bytesOut
  • mongodb_network_numRequests
  • mongodb_network_numSlowDNSOperations
  • mongodb_network_numSlowSSLOperations
  • mongodb_opLatencies_reads_latency
  • mongodb_opLatencies_reads_ops
  • mongodb_opLatencies_writes_latency
  • mongodb_opLatencies_writes_ops
  • mongodb_opcounters_delete
  • mongodb_opcounters_insert
  • mongodb_opcounters_query
  • mongodb_opcounters_update
  • up


# 0.0.1 - September 2023

* Initial release


By connecting your MongoDB Atlas instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.