postgres-health.json93 lines · main
1{
2 "uid": "briven-postgres-health",
3 "title": "postgres · health",
4 "tags": ["briven", "postgres"],
5 "timezone": "browser",
6 "schemaVersion": 39,
7 "refresh": "30s",
8 "time": { "from": "now-1h", "to": "now" },
9 "panels": [
10 {
11 "id": 1,
12 "title": "active connections",
13 "type": "timeseries",
14 "datasource": { "type": "prometheus", "uid": "Prometheus" },
15 "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
16 "targets": [
17 {
18 "expr": "pg_stat_activity_count",
19 "legendFormat": "{{datname}}"
20 }
21 ]
22 },
23 {
24 "id": 2,
25 "title": "transactions / second",
26 "type": "timeseries",
27 "datasource": { "type": "prometheus", "uid": "Prometheus" },
28 "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
29 "targets": [
30 {
31 "expr": "rate(pg_stat_database_xact_commit[1m])",
32 "legendFormat": "commits / {{datname}}"
33 },
34 {
35 "expr": "rate(pg_stat_database_xact_rollback[1m])",
36 "legendFormat": "rollbacks / {{datname}}"
37 }
38 ]
39 },
40 {
41 "id": 3,
42 "title": "deadlocks (last 1h)",
43 "type": "stat",
44 "datasource": { "type": "prometheus", "uid": "Prometheus" },
45 "gridPos": { "x": 0, "y": 8, "w": 6, "h": 4 },
46 "targets": [
47 {
48 "expr": "sum(increase(pg_stat_database_deadlocks[1h]))"
49 }
50 ]
51 },
52 {
53 "id": 4,
54 "title": "longest running query (s)",
55 "type": "stat",
56 "datasource": { "type": "prometheus", "uid": "Prometheus" },
57 "gridPos": { "x": 6, "y": 8, "w": 6, "h": 4 },
58 "targets": [
59 {
60 "expr": "max(pg_stat_activity_max_tx_duration)"
61 }
62 ],
63 "fieldConfig": {
64 "defaults": {
65 "unit": "s",
66 "thresholds": {
67 "steps": [
68 { "value": 0, "color": "green" },
69 { "value": 30, "color": "yellow" },
70 { "value": 120, "color": "red" }
71 ]
72 }
73 }
74 }
75 },
76 {
77 "id": 5,
78 "title": "database size (per project schema)",
79 "type": "timeseries",
80 "datasource": { "type": "prometheus", "uid": "Prometheus" },
81 "gridPos": { "x": 12, "y": 8, "w": 12, "h": 4 },
82 "targets": [
83 {
84 "expr": "pg_database_size_bytes",
85 "legendFormat": "{{datname}}"
86 }
87 ],
88 "fieldConfig": {
89 "defaults": { "unit": "bytes" }
90 }
91 }
92 ]
93}