Grafana Dashboards
PiVirt provides curated, pre-built Grafana dashboards for monitoring cluster topology, hypervisor resource saturation, VM performance, and storage pool throughput.
Dashboard Installation
Section titled “Dashboard Installation”Import via Grafana UI
Section titled “Import via Grafana UI”- Open Grafana web interface
- Navigate to Dashboards → Import
- Upload dashboard JSON file or enter dashboard ID
Import via Grafana API
Section titled “Import via Grafana API”# Import dashboardcurl -X POST http://localhost:3000/api/dashboards/db \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $GRAFANA_TOKEN" \ -d @pivirt-cluster-overview.jsonImport via Helm
Section titled “Import via Helm”grafana: sidecar: dashboards: enabled: true label: grafana_dashboard searchNamespace: ALL dashboardProviders: dashboardproviders.yaml: apiVersion: 1 providers: - name: 'pivirt' orgId: 1 folder: 'PiVirt' type: file disableDeletion: false editable: true options: path: /var/lib/grafana/dashboards/pivirtAvailable Dashboards
Section titled “Available Dashboards”1. PiVirt Cluster Overview
Section titled “1. PiVirt Cluster Overview”Dashboard ID: 12345
Panels:
- Cluster health status
- Node count and status
- VM count by status
- CPU/Memory/Disk utilization
- Network I/O
- API request rate
Variables:
$cluster- Cluster name$namespace- Namespace filter$interval- Time interval
2. VM Performance
Section titled “2. VM Performance”Dashboard ID: 12346
Panels:
- VM CPU usage (per VM)
- VM memory usage (per VM)
- VM disk I/O (read/write)
- VM network I/O (RX/TX)
- VM status timeline
- Top VMs by resource usage
Variables:
$namespace- Namespace filter$vm- VM name filter$interval- Time interval
3. Storage Utilization
Section titled “3. Storage Utilization”Dashboard ID: 12347
Panels:
- Storage pool capacity
- Storage pool usage
- Volume size and usage
- IOPS (read/write)
- Latency
- Replication status
Variables:
$pool- Storage pool filter$volume- Volume name filter$interval- Time interval
4. API Performance
Section titled “4. API Performance”Dashboard ID: 12348
Panels:
- API request rate
- API error rate
- API latency (p50, p95, p99)
- API request duration histogram
- Top methods by latency
- Error rate by method
Variables:
$method- API method filter$status- Status code filter$interval- Time interval
Dashboard JSON Examples
Section titled “Dashboard JSON Examples”Cluster Overview Dashboard
Section titled “Cluster Overview Dashboard”{ "dashboard": { "id": null, "uid": "pivirt-cluster-overview", "title": "PiVirt Cluster Overview", "tags": ["pivirt", "cluster"], "timezone": "browser", "panels": [ { "id": 1, "title": "Cluster Health", "type": "stat", "targets": [ { "expr": "pivirt_cluster_node_count{status=\"ready\"}", "legendFormat": "Ready Nodes" } ], "fieldConfig": { "defaults": { "thresholds": { "steps": [ {"color": "red", "value": 0}, {"color": "yellow", "value": 2}, {"color": "green", "value": 3} ] } } } }, { "id": 2, "title": "VM Count", "type": "stat", "targets": [ { "expr": "pivirt_cluster_vm_count{status=\"running\"}", "legendFormat": "Running VMs" } ] }, { "id": 3, "title": "CPU Usage", "type": "gauge", "targets": [ { "expr": "avg(pivirt_cluster_node_cpu_usage_percent)", "legendFormat": "Avg CPU" } ], "fieldConfig": { "defaults": { "unit": "percent", "max": 100 } } }, { "id": 4, "title": "Memory Usage", "type": "gauge", "targets": [ { "expr": "avg(pivirt_cluster_node_memory_usage_percent)", "legendFormat": "Avg Memory" } ], "fieldConfig": { "defaults": { "unit": "percent", "max": 100 } } }, { "id": 5, "title": "VM Count by Status", "type": "piechart", "targets": [ { "expr": "pivirt_cluster_vm_count", "legendFormat": "{{status}}" } ] }, { "id": 6, "title": "Node CPU Usage", "type": "timeseries", "targets": [ { "expr": "pivirt_cluster_node_cpu_usage_percent", "legendFormat": "{{node}}" } ] } ], "time": { "from": "now-1h", "to": "now" }, "templating": { "list": [ { "name": "cluster", "type": "query", "query": "label_values(pivirt_cluster_node_count, cluster)", "refresh": 1 }, { "name": "namespace", "type": "query", "query": "label_values(pivirtd_vm_count, namespace)", "refresh": 1 } ] } }}VM Performance Dashboard
Section titled “VM Performance Dashboard”{ "dashboard": { "id": null, "uid": "pivirt-vm-performance", "title": "VM Performance", "tags": ["pivirt", "vm"], "panels": [ { "id": 1, "title": "VM CPU Usage", "type": "timeseries", "targets": [ { "expr": "pivirtd_vm_cpu_usage_percent{namespace=~\"$namespace\", vm=~\"$vm\"}", "legendFormat": "{{vm}}" } ], "fieldConfig": { "defaults": { "unit": "percent", "max": 100 } } }, { "id": 2, "title": "VM Memory Usage", "type": "timeseries", "targets": [ { "expr": "pivirtd_vm_memory_usage_bytes{namespace=~\"$namespace\", vm=~\"$vm\"}", "legendFormat": "{{vm}}" } ], "fieldConfig": { "defaults": { "unit": "bytes" } } }, { "id": 3, "title": "VM Disk I/O", "type": "timeseries", "targets": [ { "expr": "rate(pivirtd_vm_disk_read_bytes_total{namespace=~\"$namespace\", vm=~\"$vm\"}[5m])", "legendFormat": "{{vm}} read" }, { "expr": "rate(pivirtd_vm_disk_write_bytes_total{namespace=~\"$namespace\", vm=~\"$vm\"}[5m])", "legendFormat": "{{vm}} write" } ], "fieldConfig": { "defaults": { "unit": "Bps" } } }, { "id": 4, "title": "VM Network I/O", "type": "timeseries", "targets": [ { "expr": "rate(pivirtd_vm_network_rx_bytes_total{namespace=~\"$namespace\", vm=~\"$vm\"}[5m])", "legendFormat": "{{vm}} RX" }, { "expr": "rate(pivirtd_vm_network_tx_bytes_total{namespace=~\"$namespace\", vm=~\"$vm\"}[5m])", "legendFormat": "{{vm}} TX" } ], "fieldConfig": { "defaults": { "unit": "Bps" } } }, { "id": 5, "title": "Top VMs by CPU", "type": "bargauge", "targets": [ { "expr": "topk(10, pivirtd_vm_cpu_usage_percent)", "legendFormat": "{{vm}}" } ] } ], "templating": { "list": [ { "name": "namespace", "type": "query", "query": "label_values(pivirtd_vm_count, namespace)", "refresh": 1 }, { "name": "vm", "type": "query", "query": "label_values(pivirtd_vm_cpu_usage_percent{namespace=~\"$namespace\"}, vm)", "refresh": 2, "multi": true, "includeAll": true } ] } }}Dashboard Variables
Section titled “Dashboard Variables”Common Variables
Section titled “Common Variables”{ "templating": { "list": [ { "name": "cluster", "type": "query", "datasource": "Prometheus", "query": "label_values(pivirt_cluster_node_count, cluster)", "refresh": 1, "sort": 1 }, { "name": "namespace", "type": "query", "datasource": "Prometheus", "query": "label_values(pivirtd_vm_count, namespace)", "refresh": 1, "sort": 1, "multi": true, "includeAll": true }, { "name": "interval", "type": "interval", "query": "1m,5m,15m,30m,1h", "current": { "text": "5m", "value": "5m" } } ] }}Alert Integration
Section titled “Alert Integration”Dashboard Alerts
Section titled “Dashboard Alerts”{ "alert": { "name": "VM High CPU", "conditions": [ { "evaluator": { "params": [90], "type": "gt" }, "operator": {"type": "and"}, "query": { "params": ["A", "5m", "now"] }, "reducer": { "params": [], "type": "avg" }, "type": "query" } ], "frequency": "1m", "handler": 1, "message": "VM CPU usage > 90%", "notifications": [ {"uid": "slack-alerts"} ] }}Provisioning
Section titled “Provisioning”Dashboard Provisioning
Section titled “Dashboard Provisioning”apiVersion: 1
providers: - name: 'PiVirt' orgId: 1 folder: 'PiVirt' type: file disableDeletion: false updateIntervalSeconds: 30 allowUiUpdates: true options: path: /var/lib/grafana/dashboards/pivirt foldersFromFilesStructure: trueDatasource Provisioning
Section titled “Datasource Provisioning”apiVersion: 1
datasources: - name: Prometheus type: prometheus access: proxy url: http://prometheus:9090 isDefault: true editable: falseBest Practices
Section titled “Best Practices”1. Use Variables
Section titled “1. Use Variables”- Use template variables for filtering
- Make dashboards reusable across clusters
- Allow users to focus on specific resources
2. Organize Dashboards
Section titled “2. Organize Dashboards”- Group related panels
- Use rows for logical separation
- Keep dashboards focused
3. Set Appropriate Time Ranges
Section titled “3. Set Appropriate Time Ranges”- Default to 1h for operational dashboards
- Use 24h for trend analysis
- Allow users to adjust time range
4. Use Thresholds
Section titled “4. Use Thresholds”- Color-code panels based on thresholds
- Make critical issues immediately visible
- Use consistent color scheme
5. Document Dashboards
Section titled “5. Document Dashboards”- Add descriptions to panels
- Document variables and filters
- Include links to related documentation