apiVersion: v1 kind: ConfigMap metadata: name: postgres-dashboard namespace: observability labels: grafana_dashboard: "1" data: postgres.json: | { "annotations": { "list": [] }, "editable": true, "graphTooltip": 1, "id": null, "links": [], "panels": [ { "title": "Active Connections", "type": "timeseries", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 }, "targets": [ { "expr": "cnpg_backends_total", "legendFormat": "{{ pod }}" } ] }, { "title": "Transactions per Second", "type": "timeseries", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 }, "targets": [ { "expr": "rate(cnpg_pg_stat_database_xact_commit{datname=\"homelab\"}[5m])", "legendFormat": "commits {{ pod }}" }, { "expr": "rate(cnpg_pg_stat_database_xact_rollback{datname=\"homelab\"}[5m])", "legendFormat": "rollbacks {{ pod }}" } ], "fieldConfig": { "defaults": { "unit": "ops" } } }, { "title": "Replication Lag (bytes)", "type": "timeseries", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 }, "targets": [ { "expr": "cnpg_pg_replication_lag", "legendFormat": "{{ pod }}" } ], "fieldConfig": { "defaults": { "unit": "bytes" } } }, { "title": "Database Size", "type": "stat", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 }, "targets": [ { "expr": "cnpg_pg_database_size_bytes{datname=\"homelab\"}", "legendFormat": "{{ pod }}" } ], "fieldConfig": { "defaults": { "unit": "bytes" } } } ], "schemaVersion": 39, "tags": ["homelab", "postgres", "cnpg"], "templating": { "list": [] }, "time": { "from": "now-6h", "to": "now" }, "title": "PostgreSQL (CloudNativePG)", "uid": "postgres-cnpg" }