Copies every dashboard from `ansible/roles/grafana-observability/files/dashboards/` into `kubernetes/apps/monitoring/dashboards/` and wires each as a ConfigMap for the kube-prometheus-stack Grafana sidecar. UID rewrites follow the buckets in DASHBOARD-MIGRATION.md: - 11 k8s-native dashboards copied with no rewrite (UID stays `prometheus`/`loki`/`influxdb`). - 9 host-legacy + 3 mixed-resolved-as-legacy (blackbox, infrastructure, synology-nas Prom panels) had every `"uid": "prometheus"` rewritten to `"uid": "prometheus-legacy"` so they continue to render against LXC 227 until the global cut-over retires VM 109. - log-explorer and netbird-overview are pure Loki, no rewrite. - paperless-overview and unifi-overview kept on `prometheus` (paperless per k8s-native intent; unifi because the K8s Prom also scrapes the same unpoller exporter). Validated with `kubectl kustomize kubernetes/apps/monitoring`: 27 ConfigMaps generated, all carrying the `grafana_dashboard: "1"` label that the sidecar watches in the `monitoring` namespace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
222 lines
14 KiB
JSON
222 lines
14 KiB
JSON
{
|
|
"annotations": {"list": []},
|
|
"description": "PostgreSQL Database Monitoring",
|
|
"editable": true,
|
|
"fiscalYearStartMonth": 0,
|
|
"graphTooltip": 1,
|
|
"id": null,
|
|
"links": [],
|
|
"panels": [
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {"color": {"mode": "thresholds"}, "mappings": [{"options": {"1": {"color": "green", "index": 0, "text": "Up"}}, "type": "value"}, {"options": {"0": {"color": "red", "index": 1, "text": "Down"}}, "type": "value"}], "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "green", "value": 1}]}},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 4, "w": 4, "x": 0, "y": 0},
|
|
"id": 1,
|
|
"options": {"colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
|
|
"targets": [{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_up", "refId": "A"}],
|
|
"title": "Database Status",
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {"color": {"mode": "thresholds"}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "yellow", "value": 50}, {"color": "red", "value": 80}]}},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 4, "w": 5, "x": 4, "y": 0},
|
|
"id": 2,
|
|
"options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
|
|
"targets": [{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum(pg_stat_activity_count{state=\"active\"})", "refId": "A"}],
|
|
"title": "Active Connections",
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {"color": {"mode": "thresholds"}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "blue", "value": null}]}, "unit": "bytes"},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 4, "w": 5, "x": 9, "y": 0},
|
|
"id": 3,
|
|
"options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
|
|
"targets": [{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum(pg_database_size_bytes)", "refId": "A"}],
|
|
"title": "Total Database Size",
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {"color": {"mode": "thresholds"}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]}},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 4, "w": 5, "x": 14, "y": 0},
|
|
"id": 4,
|
|
"options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
|
|
"targets": [{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum(pg_locks_count)", "refId": "A"}],
|
|
"title": "Active Locks",
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {"color": {"mode": "thresholds"}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "yellow", "value": 100}, {"color": "red", "value": 1000}]}},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 4, "w": 5, "x": 19, "y": 0},
|
|
"id": 5,
|
|
"options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
|
|
"targets": [{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum(rate(pg_stat_database_xact_commit[5m]) + rate(pg_stat_database_xact_rollback[5m]))", "refId": "A"}],
|
|
"title": "Transactions/sec",
|
|
"type": "stat"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {"mode": "palette-classic"},
|
|
"custom": {"axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "lineInterpolation": "smooth", "lineWidth": 2, "pointSize": 5, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}, "thresholdsStyle": {"mode": "off"}},
|
|
"mappings": [],
|
|
"thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]},
|
|
"unit": "short"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 4},
|
|
"id": 6,
|
|
"options": {"legend": {"calcs": ["mean", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_stat_activity_count{state=\"active\"}", "legendFormat": "Active", "refId": "A"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_stat_activity_count{state=\"idle\"}", "legendFormat": "Idle", "refId": "B"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_stat_activity_count{state=\"idle in transaction\"}", "legendFormat": "Idle in Transaction", "refId": "C"}
|
|
],
|
|
"title": "Connection States",
|
|
"type": "timeseries"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {"mode": "palette-classic"},
|
|
"custom": {"axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "lineInterpolation": "smooth", "lineWidth": 2, "pointSize": 5, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}, "thresholdsStyle": {"mode": "off"}},
|
|
"mappings": [],
|
|
"thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]},
|
|
"unit": "ops"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 4},
|
|
"id": 7,
|
|
"options": {"legend": {"calcs": ["mean", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "rate(pg_stat_database_xact_commit[5m])", "legendFormat": "Commits - {{datname}}", "refId": "A"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "rate(pg_stat_database_xact_rollback[5m])", "legendFormat": "Rollbacks - {{datname}}", "refId": "B"}
|
|
],
|
|
"title": "Transaction Rate",
|
|
"type": "timeseries"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {"mode": "palette-classic"},
|
|
"custom": {"axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "lineInterpolation": "smooth", "lineWidth": 2, "pointSize": 5, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}, "thresholdsStyle": {"mode": "off"}},
|
|
"mappings": [],
|
|
"thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]},
|
|
"unit": "percent"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 12},
|
|
"id": 8,
|
|
"options": {"legend": {"calcs": ["mean", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_stat_database_blks_hit / (pg_stat_database_blks_hit + pg_stat_database_blks_read + 0.001) * 100", "legendFormat": "{{datname}}", "refId": "A"}
|
|
],
|
|
"title": "Cache Hit Ratio",
|
|
"type": "timeseries"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {"mode": "palette-classic"},
|
|
"custom": {"axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "lineInterpolation": "smooth", "lineWidth": 2, "pointSize": 5, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}, "thresholdsStyle": {"mode": "off"}},
|
|
"mappings": [],
|
|
"thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]},
|
|
"unit": "bytes"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 12},
|
|
"id": 9,
|
|
"options": {"legend": {"calcs": ["lastNotNull"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_database_size_bytes{datname!~\"template.*\"}", "legendFormat": "{{datname}}", "refId": "A"}
|
|
],
|
|
"title": "Database Sizes",
|
|
"type": "timeseries"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {"mode": "palette-classic"},
|
|
"custom": {"axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "lineInterpolation": "smooth", "lineWidth": 2, "pointSize": 5, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}, "thresholdsStyle": {"mode": "off"}},
|
|
"mappings": [],
|
|
"thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]},
|
|
"unit": "ops"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 20},
|
|
"id": 10,
|
|
"options": {"legend": {"calcs": ["mean", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "rate(pg_stat_database_tup_fetched[5m])", "legendFormat": "Fetched - {{datname}}", "refId": "A"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "rate(pg_stat_database_tup_inserted[5m])", "legendFormat": "Inserted - {{datname}}", "refId": "B"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "rate(pg_stat_database_tup_updated[5m])", "legendFormat": "Updated - {{datname}}", "refId": "C"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "rate(pg_stat_database_tup_deleted[5m])", "legendFormat": "Deleted - {{datname}}", "refId": "D"}
|
|
],
|
|
"title": "Tuple Operations",
|
|
"type": "timeseries"
|
|
},
|
|
{
|
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {"mode": "palette-classic"},
|
|
"custom": {"axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "lineInterpolation": "smooth", "lineWidth": 2, "pointSize": 5, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}, "thresholdsStyle": {"mode": "off"}},
|
|
"mappings": [],
|
|
"thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}]},
|
|
"unit": "s"
|
|
},
|
|
"overrides": []
|
|
},
|
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 20},
|
|
"id": 11,
|
|
"options": {"legend": {"calcs": ["mean", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}},
|
|
"targets": [
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_replication_lag_seconds", "legendFormat": "Replication Lag", "refId": "A"},
|
|
{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "pg_stat_activity_max_tx_duration", "legendFormat": "Max Transaction Duration", "refId": "B"}
|
|
],
|
|
"title": "Replication & Transaction Health",
|
|
"type": "timeseries"
|
|
}
|
|
],
|
|
"refresh": "30s",
|
|
"schemaVersion": 38,
|
|
"style": "dark",
|
|
"tags": ["homelab", "postgresql", "database"],
|
|
"templating": {"list": []},
|
|
"time": {"from": "now-1h", "to": "now"},
|
|
"timepicker": {},
|
|
"timezone": "",
|
|
"title": "PostgreSQL Overview",
|
|
"uid": "postgresql-overview",
|
|
"version": 1,
|
|
"weekStart": ""
|
|
}
|