MongoDB integration for Grafana Cloud
MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.
This integration monitors a MongoDB Cluster using the Percona MongoDB Exporter, which is embedded in the Grafana Agent for ease of use, from version 0.19.0 upwards.
It creates 3 different dashboards for monitoring a MongoDB cluster, a specific instance and a ReplicaSet. It also ships the following Prometheus alerts:
- MongodbDown: A MongoDB instance is down - Critical
- MongodbReplicationLag: MongoDB replication lag is more than 10s - Critical
- MongodbReplicationHeadroom: MongoDB replication headroom is <= 0 - Critical
- MongodbNumberCursorsOpen: Too many cursors opened by MongoDB for clients (> 10k) - Warning
- MongodbCursorsTimeouts: Too many cursors are timing out - Warning
- MongodbTooManyConnections: Too many connections (above 80% of the historical average) - warning
- MongodbVirtualMemoryUsage: MongoDB virtual memory usage more than 3x higher than mapped memory - warning
In order for this integration to work prorperly, you have to connect each node of your mongoDB cluster to an agent instance. That’s because this exporter does not collect metrics from multiple nodes.
Additionally, you need to define two custom label for you metrics using relabel_configs.
The first one is service_name, which is how you identify this node in your cluster (example: ReplicaSet1-Node1). The second one is mongodb_cluster, which is the name of your mongodb cluster, and must be set the same value for all nodes composing the cluster (example: prod-cluster).
Here`s an example:
relabel_configs: - source_labels: [__address__] target_label: service_name replacement: 'replicaset1-node1' - source_labels: [__address__] target_label: mongodb_cluster replacement: 'prod-cluster'
We strongly recommend that you configure a separate user for the Agent, and give it only the strictly mandatory security privileges necessary for monitoring your node. For more information, see the official documentation.
Please refer to the full reference of options in Grafana Agent configuration reference.
Related Grafana Cloud resources
How to set up and visualize synthetic monitoring at scale with Grafana Cloud
Learn how to use Kubernetes, Grafana Loki, and Grafana Cloud’s synthetic monitoring feature to set up your infrastructure's checks in this GrafanaCONline session.
Using Grafana Cloud to drive manufacturing plant efficiency
This GrafanaCONline session tells how Grafana helps a 75-year-old manufacturing company with product quality and equipment maintenance.