Grafana dashboard templates for use with the prometheus_mongodb_exporter for MongoDB w/Prometheus
- Cluster Summary, Sharding, Replica Set and single-instance dashboards for Percona Server MongoDB / MongoDB
- Grouping of OS metrics with MongoDB instances
- Cluster, replica set and node member discovery via Prometheus data
- WiredTiger storage engine metrics (beta/experimental)
- A Prometheus server (https://prometheus.io/)
- A Grafana 2.0+ server (http://grafana.org/)
- The prometheus_mongodb_exporter for Prometheus on at least one Percona Server MongoDB or MongoDB instance
- The node_exporter for Prometheus on each node running the prometheus_mongodb_exporter
- "Target Group" labels in Prometheus server configuration file (See "Prometheus Configuration")
- Prometheus is added as a Data Source to Grafana with the Data Source name "Prometheus" (otherwise you need to change the "datasource" field in the templates)
The grouping of metrics of the OS (node_exporter) and MongoDB (prometheus_mongodb_exporter) is achieved by using labels applied to Prometheus Target Groups in the Prometheus server config file (prometheus.yml).
Each MongoDB instance to be monitored must be added as a new group in the prometheus.yml file with both the 'node' and 'mongodb' exporter as 'targets'.
Each MongoDB instance added must also have the following labels added to it's target group:
- 'cluster' - A human-defined name for the cluster the node is part of. required
- 'alias' - A field containing the MongoDB hostname/port combination for the instance. required
- 'nodetype' - A field for grouping node types: 'mongod' for standalone/replset instances, 'config' for shard config servers and 'mongos' for shard mongos instances. required
- 'replset' - An field for instances that are members of a MongoDB Replication Set. This must match the replset name seen in the MongoDB command 'rs.status()'. optional
Example target section for a replset member of "shard12" (port 9140 = prometheus_mongodb_exporter/port 9100 = node_exporter):
- targets: ['tyrion.westeros.com:9140','tyrion.westeros.com:9100']
labels:
alias: 'tyrion.westeros.com:27017'
nodetype: 'mongod'
replset: 'shard12'
cluster: 'prodCluster'
Example target section for a mongos member (notice no 'replset' label because it is mongos):
- targets: ['arya.westeros.com:9140','arya.westeros.com:9100']
labels:
alias: 'arya.westeros.com:27018'
nodetype: 'mongos'
cluster: 'prodCluster'
- Install and start Prometheus and Grafana 2.0+ servers with default configuration (not explained here)
- Configure Grafana to use Prometheus as a Data Source. Link: Grafana Support for Prometheus: Using
- Install prometheus_mongodb_exporter on all nodes that run MongoDB. Link: Readme
- Install node_exporter on all nodes that run the prometheus_mongodb_exporter. Link: Readme
- For each instance to monitor, add 'targets' and 'labels' to the prometheus.yml file as described in 'Prometheus Configuration' section above
- Reload Prometheus configuration file ("kill -HUP PID") or restart the Prometheus process/service
- Import each Grafana template file from the 'dashboards' subdir into Grafana's UI and press 'Save' after each import. Link: Import/Export Templates (Grafana Docs)
- Add storage engine metrics for PerconaFT and RocksDB, when they're available in the exporter
- Automate/rethink target 'labels' in prometheus.yml (used for grouping metrics in graphs)
- Version scheme