"description": "cnpg_collector_up from the instance manager (:9187) \u2014 1 = PostgreSQL answering.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 5,
"w": 4,
"x": 0,
"y": 1
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "min by (namespace) (cnpg_collector_up{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto",
"justifyMode": "auto"
}
},
{
"id": 25,
"type": "stat",
"title": "Nodes used / instances",
"description": "1 with instances: 1 \u2014 no HA. Documented as a known limit, not a fault.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 5,
"w": 4,
"x": 4,
"y": 1
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace) (cnpg_collector_nodes_used{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto",
"justifyMode": "auto"
}
},
{
"id": 26,
"type": "stat",
"title": "Connections used",
"description": "pg_stat_activity backends, all states.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 5,
"w": 4,
"x": 8,
"y": 1
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (namespace) (cnpg_backends_total{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto",
"justifyMode": "auto"
}
},
{
"id": 27,
"type": "stat",
"title": "Connections / max_connections",
"description": "Used against the server's own max_connections setting, so it stays right if the setting changes.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 5,
"w": 4,
"x": 12,
"y": 1
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "100 * sum by (namespace) (cnpg_backends_total{namespace=~\"$namespace\"}) / max by (namespace) (cnpg_pg_settings_setting{namespace=~\"$namespace\",name=\"max_connections\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 70
},
{
"color": "red",
"value": 90
}
]
},
"unit": "percent"
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto",
"justifyMode": "auto"
}
},
{
"id": 28,
"type": "stat",
"title": "Manual switchover required",
"description": "1 = the operator is asking for a manual switchover (e.g. after a fencing event).",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 5,
"w": 4,
"x": 16,
"y": 1
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace) (cnpg_collector_manual_switchover_required{namespace=~\"$namespace\"})",
"description": "0 = never. sirius-growth/portal archives through the CNPG-I Barman Cloud plugin, which exposes its own metric family `barman_cloud_cloudnative_pg_io_*`; the in-tree `cnpg_collector_*` name is kept in the `or` for any cluster still on the deprecated path. A 0 means neither series exists.",
"expr": "max by (namespace) (cnpg_collector_last_available_backup_timestamp{namespace=~\"$namespace\"} or barman_cloud_cloudnative_pg_io_last_available_backup_timestamp{namespace=~\"$namespace\"})",
"description": "shared_buffers hit ratio. A lab database with 256Mi request will sit high; a drop means the working set outgrew the buffers.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 8,
"w": 6,
"x": 18,
"y": 7
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (namespace) (rate(cnpg_pg_stat_database_blks_hit{namespace=~\"$namespace\"}[5m])) / clamp_min(sum by (namespace) (rate(cnpg_pg_stat_database_blks_hit{namespace=~\"$namespace\"}[5m])) + sum by (namespace) (rate(cnpg_pg_stat_database_blks_read{namespace=~\"$namespace\"}[5m])), 0.0000001)",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}}"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"lineWidth": 1,
"fillOpacity": 0,
"showPoints": "never"
},
"color": {
"mode": "palette-classic"
},
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 34,
"type": "row",
"title": "Errors and pressure",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 15
},
"panels": []
},
{
"id": 35,
"type": "timeseries",
"title": "Deadlocks (24h increase)",
"description": "increase() on a counter that exists on every database, so a quiet DB renders a hard 0 rather than 'No data'.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 8,
"w": 8,
"x": 0,
"y": 16
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (namespace) (increase(cnpg_pg_stat_database_deadlocks{namespace=~\"$namespace\"}[24h]))",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}}"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"lineWidth": 1,
"fillOpacity": 0,
"showPoints": "never"
},
"color": {
"mode": "palette-classic"
},
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 36,
"type": "timeseries",
"title": "Temp bytes/s",
"description": "Spill to disk from sorts/hashes that did not fit work_mem. Non-zero during Forgejo Actions index scans is expected.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 8,
"w": 8,
"x": 8,
"y": 16
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (namespace) (rate(cnpg_pg_stat_database_temp_bytes{namespace=~\"$namespace\"}[5m]))",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}}"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"lineWidth": 1,
"fillOpacity": 0,
"showPoints": "never"
},
"color": {
"mode": "palette-classic"
},
"unit": "Bps"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 37,
"type": "timeseries",
"title": "Longest transaction age",
"description": "Longest open transaction (pg_stat_activity.xact_start). The CNPG default query set exposes transaction age, not per-statement query age \u2014 see docs.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 16
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace) (cnpg_backends_max_tx_duration_seconds{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}}"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"lineWidth": 1,
"fillOpacity": 0,
"showPoints": "never"
},
"color": {
"mode": "palette-classic"
},
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 38,
"type": "row",
"title": "Size, WAL, replication",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 24
},
"panels": []
},
{
"id": 39,
"type": "timeseries",
"title": "Database size",
"description": "pg_database_size. Both PVs are 10Gi (forgejo/pg) and 5Gi (sirius-growth/portal) \u2014 this is the trend that fills them.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 8,
"w": 8,
"x": 0,
"y": 25
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace, datname) (cnpg_pg_database_size_bytes{namespace=~\"$namespace\",datname!~\"template.*|postgres\"})",
"description": "Bytes of WAL written per second. sirius-growth/portal archives its WAL to the Linode Garage; forgejo/pg does not archive, so its WAL only ever fills the pg_wal directory.",
"description": "pg_stat_archiver.failed_count. Archiving is configured only on sirius-growth/portal (Barman Cloud plugin -> Linode Garage); forgejo/pg has no archiver, so any non-zero value is the honest signal that WAL failed to reach the archive.",
"expr": "max by (namespace) (cnpg_pg_stat_archiver_failed_count{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}}"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"lineWidth": 1,
"fillOpacity": 0,
"showPoints": "never"
},
"color": {
"mode": "palette-classic"
},
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 42,
"type": "row",
"title": "Replication (single instance \u2014 panels are honest about it)",
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 33
},
"panels": []
},
{
"id": 43,
"type": "timeseries",
"title": "Replication lag",
"description": "0 on the primary with no standby. With instances: 1 this metric is structurally zero, not evidence that replication is healthy.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 6,
"w": 8,
"x": 0,
"y": 34
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace) (cnpg_pg_replication_lag{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}}"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"lineWidth": 1,
"fillOpacity": 0,
"showPoints": "never"
},
"color": {
"mode": "palette-classic"
},
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 44,
"type": "timeseries",
"title": "Streaming replicas / in recovery",
"description": "Both clusters run instances: 1, so 0 streaming replicas and in_recovery=0 is the correct reading. A future replica would light these up with no dashboard change.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 6,
"w": 8,
"x": 8,
"y": 34
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace) (cnpg_pg_replication_streaming_replicas{namespace=~\"$namespace\"})",
"refId": "A",
"editorMode": "code",
"range": true,
"instant": false,
"legendFormat": "{{namespace}} streaming"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (namespace) (cnpg_pg_replication_in_recovery{namespace=~\"$namespace\"})",
"content": "- **Backups exist on one cluster only.** `sirius-growth/portal` archives WAL + daily base backups\n through the CNPG-I Barman Cloud plugin (`ObjectStore portal-wal`) into the Linode Garage;\n `forgejo/pg` has no archiver by design. The \"Last available backup\" stat reads 0 only if neither\n the plugin's `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` nor the legacy\n `cnpg_collector_last_available_backup_timestamp` series exists.\n- **Single instance.** Both clusters run `instances: 1`, so replication lag / streaming replicas /\n in recovery are structurally zero. The panels show the zero and say so instead of hiding them.\n- **Query age vs transaction age.** CNPG's default query set exposes\n `cnpg_backends_max_tx_duration_seconds` (transaction age). Per-statement `query_start` age is not in\n the default set; adding it would need another custom query in the cluster's\n `customQueriesConfigMap`.\n- **Permissions.** Custom queries run as `cnpg_metrics_exporter`, not superuser. See\n docs/monitoring-dashboards.md for the GRANT the Forgejo Actions metrics need.\n"