Grafana Dashboards
Relevant source files
The following files were used as context for generating this wiki page:
Grafana Dashboards within Percona Monitoring and Management (PMM) provide a "single pane of glass" for monitoring the performance of database environments, including MySQL, MongoDB, PostgreSQL, and ClickHouse. These dashboards leverage deep database expertise to offer expertly designed visualizations that track metrics across on-premises, cloud, or hybrid environments.
Sources: README.md:16-20, ui/apps/pmm/src/contexts/tour/steps/product.messages.ts:2-8
The system is built on Grafana, allowing for extensive customization, expansion, and integration with existing monitoring workflows. It serves as the primary frontend for visualizing metrics collected by PMM Client exporters and stored in VictoriaMetrics.
Sources: ui/apps/pmm/src/contexts/tour/steps/product.messages.ts:9-11, CONTRIBUTING.md:43-45
Architecture and Data Flow
The dashboard system functions as a Grafana plugin (App), defined in plugin.json. It coordinates between the PMM Server backend and the user interface to display real-time and historical database metrics.
Component Relationship
The following diagram illustrates how Grafana Dashboards interact with other PMM components to visualize data.
The PMM Server manages VictoriaMetrics for time-series data and ClickHouse for Query Analytics (QAN). Grafana queries these data sources to populate dashboard panels.
Sources: CONTRIBUTING.md:31-60, managed/services/supervisord/supervisord.go:377-500
Ingestion and Query Logic
Dashboards utilize a variety of data sources. While most metrics come from VictoriaMetrics via PromQL, specific analytics rely on ClickHouse.
Sources: dashboards/pmm-app/src/dashboards/PMM%20Health/Environments_Overview.json:1155-1163
| Data Source | Primary Use Case |
|---|---|
| Metrics (VictoriaMetrics) | Standard performance metrics (CPU, RAM, Disk, DB Status) |
| ClickHouse | Query Latency and detailed query performance analysis |
| Grafana (Built-in) | Dashboard annotations and internal alerting |
Sources: dashboards/pmm-app/src/dashboards/PMM%20Health/Environments_Overview.json:1172-1175, dashboards/pmm-app/src/dashboards/PMM%20Health/PMM_Health.json:17-48
Dashboard Structure and Templating
PMM Dashboards utilize complex JSON definitions that include specific variables (templates) to allow users to filter data by Environment, Node, or Service.
Variable Cascading
Dashboards often implement a cascading filter system where selecting an environment updates the available nodes, which in turn updates the available services.
Example variable definitions from Environments_Overview.json:
environment:label_values(up, environment)node_name:label_values(up{environment=~"$environment",node_type=~"generic|remote_rds|container|remote"}, node_name)service_name:label_values({__name__=~"pg_up|mysql_up|mongodb_up",node_name=~"$node_name"}, service_name)
Sources: dashboards/pmm-app/src/dashboards/PMM%20Health/Environments_Overview.json:1561-1678
Key Features and Functional Categories
Dashboards are organized by technology stack and monitoring depth.
PMM Health and Overview
These dashboards monitor the PMM infrastructure itself and provide high-level summaries.
- Environments Overview: Displays CPU, Memory, and Disk usage aggregated across all monitored environments.
- PMM Health: Monitors internal PMM components like
pmm-managed, VictoriaMetrics status, and ClickHouse version/revision.
Sources: dashboards/pmm-app/src/dashboards/PMM%20Health/Environments_Overview.json:10-25, dashboards/pmm-app/src/dashboards/PMM%20Health/PMM_Health.json:1086-1100
Database Specific Monitoring
PMM includes specialized dashboards for several database engines:
- MySQL: Instance Summary, InnoDB Details, Replication Summary.
- PostgreSQL: Instance Summary, Transactions, Tuples.
- MongoDB: Cluster Summary, WiredTiger Details, InMemory Details.
- ClickHouse: Instance Summary, Query Performance.
Sources: dashboards/README.md:3-56, dashboards/pmm-app/src/plugin.json:44-245
OS and Hardware Monitoring
Generic OS dashboards provide insight into the underlying infrastructure:
- Node Summary: CPU utilization, Load Average, RAM, and Disk Space.
- Network Details: Inbound and Outbound traffic rates.
Sources: dashboards/pmm-app/src/dashboards/PMM%20Health/PMM_Health.json:321-343
Development and Contribution
The dashboards are stored as JSON files in the dashboards/ directory. Developers contribute by modifying these JSON definitions or adding new ones.
Local Development Environment
The project uses Docker Compose to set up a local development environment.
cd pmm-app
docker-compose up -d
yarn dev
Front-end artifacts are mapped to /var/lib/grafana/plugins so they are picked up by the Grafana server.
Sources: dashboards/CONTRIBUTING.md:43-55
Dashboard Metadata
Dashboard metadata is managed in package.json and plugin.json within the pmm-app folder. The plugin.json file explicitly registers every dashboard path and UID to the Grafana App.
Sources: dashboards/pmm-app/package.json:1-40, dashboards/pmm-app/src/plugin.json:30-245
Summary
Grafana Dashboards in PMM provide a comprehensive visualization layer for database and system metrics. By integrating VictoriaMetrics and ClickHouse data sources, they offer both high-level infrastructure overviews and granular performance analysis for MySQL, PostgreSQL, and MongoDB. The system's architecture as a Grafana plugin allows for a standardized but flexible environment where community members can contribute via JSON dashboard definitions and automated deployment scripts.
Sources: README.md:16-25, dashboards/README.md:58-64, dashboards/CONTRIBUTING.md:1-10