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
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find MongoDB Atlas and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send MongoDB Atlas metrics to your Grafana Cloud instance.
- 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.
<prom_password> fields to match the username and password created when activating the Prometheus integration.
<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
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 basic_auth: username: <prom_username> password: <prom_password> http_sd_configs: - url: https://cloud.mongodb.com/prometheus/v1.0/groups/<group_id>/discovery refresh_interval: 60s basic_auth: 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.
integrations: prometheus_remote_write: - basic_auth: password: <your_prom_pass> username: <your_prom_user> url: <your_prom_url> agent: enabled: true relabel_configs: - action: replace source_labels: - agent_hostname target_label: instance - action: replace target_label: job replacement: "integrations/agent-check" metric_relabel_configs: - action: keep regex: (prometheus_target_.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds) source_labels: - __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. logs: configs: - clients: - basic_auth: password: <your_loki_pass> username: <your_loki_user> url: <your_loki_url> name: integrations positions: filename: /tmp/positions.yaml scrape_configs: # 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. metrics: configs: - name: integrations remote_write: - basic_auth: password: <your_prom_pass> username: <your_prom_user> url: <your_prom_url> scrape_configs: # 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 basic_auth: username: <prom_username> password: <prom_password> http_sd_configs: - url: https://cloud.mongodb.com/prometheus/v1.0/groups/<group_id>/discovery refresh_interval: 60s basic_auth: username: <prom_username> password: <prom_password> global: 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:
|MongoDBAtlasHighNumberOfCollectionExclusiveDeadlocks||Warning: There is a high number of collection exclusive deadlocks occurring.|
|MongoDBAtlasHighNumberOfCollectionIntentExclusiveDeadlocks||Warning: There is a high number of collection intent-exclusive deadlocks occurring.|
|MongoDBAtlasHighNumberOfCollectionSharedDeadlocks||Warning: There is a high number of collection shared deadlocks occurring.|
|MongoDBAtlasHighNumberOfCollectionIntentSharedDeadlocks||Warning: There is a high number of collection intent-shared deadlocks occurring.|
|MongoDBAtlasHighNumberOfDatabaseExclusiveDeadlocks||Warning: There is a high number of database exclusive deadlocks occurring.|
|MongoDBAtlasHighNumberOfDatabaseIntentExclusiveDeadlocks||Warning: There is a high number of database intent-exclusive deadlocks occurring.|
|MongoDBAtlasHighNumberOfDatabaseSharedDeadlocks||Warning: There is a high number of database shared deadlocks occurring.|
|MongoDBAtlasHighNumberOfDatabaseIntentSharedDeadlocks||Warning: There is a high number of database intent-shared deadlocks occurring.|
|MongoDBAtlasHighNumberOfSlowNetworkRequests||Warning: There is a high number of slow network requests.|
|MongoDBAtlasDiskSpaceLow||Warning: Hardware is running out of disk space.|
|MongoDBAtlasSlowHardwareIO||Warning: Read and write I/Os are taking too long to complete.|
|MongoDBAtlasHighNumberOfTimeoutElections||Warning: 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:
# 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.