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.

Post-install configuration for the MongoDB Atlas integration

After enabling MongoDB Atlas’ prometheus integration, instruct the Grafana Agent to scrape your Atlas project clusters.

Change the <prom_username> and <prom_password> fields to match the username and password created when activating the Prometheus integration.

Change the <group_id> in the http_sd_configs.url field to match the project id for the project the Prometheus integration was activated for.

Configuration snippets for Grafana Agent

Below metrics.configs.scrape_configs, insert the following lines and change the URLs according to your environment:

    - job_name: integrations/mongodb-atlas
      scrape_interval: 10s
      metrics_path: /metrics
      scheme: https
        username: <prom_username>
        password: <prom_password>
        - url:<group_id>/discovery
          refresh_interval: 60s
            username: <prom_username>
            password: <prom_password>

Full example configuration for Grafana Agent

Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the MongoDB Atlas integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.

  - basic_auth:
      password: <your_prom_pass>
      username: <your_prom_user>
    url: <your_prom_url>
    enabled: true
    - action: replace
      - agent_hostname
      target_label: instance
    - action: replace
      target_label: job
      replacement: "integrations/agent-check"
    - action: keep
      regex: (prometheus_target_.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
      - __name__
  # Add here any snippet that belongs to the `integrations` section.
  # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
  - clients:
    - basic_auth:
        password: <your_loki_pass>
        username: <your_loki_user>
      url: <your_loki_url>
    name: integrations
      filename: /tmp/positions.yaml
      # Add here any snippet that belongs to the `logs.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
  - name: integrations
    - basic_auth:
        password: <your_prom_pass>
        username: <your_prom_user>
      url: <your_prom_url>
      # Add here any snippet that belongs to the `metrics.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
    - job_name: integrations/mongodb-atlas
      scrape_interval: 10s
      metrics_path: /metrics
      scheme: https
        username: <prom_username>
        password: <prom_password>
        - url:<group_id>/discovery
          refresh_interval: 60s
            username: <prom_username>
            password: <prom_password>
    scrape_interval: 60s
  wal_directory: /tmp/grafana-agent-wal


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 2 (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


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