{ "title": "PostgreSQL", "uid": "postgres-overview", "tags": ["postgres", "database"], "schemaVersion": 39, "version": 1, "refresh": "1m", "time": { "from": "now-6h", "to": "now" }, "timezone": "browser", "editable": true, "graphTooltip": 1, "templating": { "list": [ { "name": "instance", "label": "Host", "type": "query", "datasource": { "type": "prometheus", "uid": "prometheus" }, "query": { "query": "label_values(up{job=\"postgres\"}, instance)", "refId": "A" }, "refresh": 2, "multi": false, "includeAll": false, "sort": 1, "current": { "selected": false, "text": "", "value": "" } } ] }, "panels": [ { "id": 1, "type": "stat", "title": "Up", "gridPos": { "h": 4, "w": 6, "x": 0, "y": 0 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "none", "color": { "mode": "thresholds" }, "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 1 } ] }, "mappings": [ { "type": "value", "options": { "0": { "text": "Down", "color": "red" }, "1": { "text": "Up", "color": "green" } } } ] }, "overrides": [] }, "options": { "reduceOptions": { "values": false, "calcs": ["lastNotNull"], "fields": "" }, "colorMode": "background", "graphMode": "none", "textMode": "auto", "justifyMode": "auto", "orientation": "auto" }, "targets": [ { "refId": "A", "expr": "pg_up{instance=\"$instance\"}" } ] }, { "id": 2, "type": "timeseries", "title": "Active Connections", "gridPos": { "h": 4, "w": 18, "x": 6, "y": 0 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "short", "color": { "mode": "palette-classic" }, "custom": { "fillOpacity": 20, "lineWidth": 1, "drawStyle": "line", "showPoints": "never" } }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum by (datname) (pg_stat_database_numbackends{instance=\"$instance\"})", "legendFormat": "{{datname}}" } ] }, { "id": 3, "type": "timeseries", "title": "Cache Hit Ratio", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "percentunit", "min": 0, "max": 1, "color": { "mode": "palette-classic" }, "custom": { "fillOpacity": 20, "lineWidth": 1, "drawStyle": "line", "showPoints": "never" } }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum(rate(pg_stat_database_blks_hit{instance=\"$instance\"}[$__rate_interval])) / (sum(rate(pg_stat_database_blks_hit{instance=\"$instance\"}[$__rate_interval])) + sum(rate(pg_stat_database_blks_read{instance=\"$instance\"}[$__rate_interval])))", "legendFormat": "hit ratio" } ] }, { "id": 4, "type": "timeseries", "title": "Transactions", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "ops", "color": { "mode": "palette-classic" }, "custom": { "fillOpacity": 10, "lineWidth": 1, "drawStyle": "line", "showPoints": "never" } }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "rate(pg_stat_database_xact_commit{instance=\"$instance\"}[$__rate_interval])", "legendFormat": "commit" }, { "refId": "B", "expr": "rate(pg_stat_database_xact_rollback{instance=\"$instance\"}[$__rate_interval])", "legendFormat": "rollback" } ] }, { "id": 5, "type": "timeseries", "title": "Deadlocks", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 12 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "ops", "color": { "mode": "palette-classic" }, "custom": { "fillOpacity": 20, "lineWidth": 1, "drawStyle": "line", "showPoints": "never" } }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "rate(pg_stat_database_deadlocks{instance=\"$instance\"}[$__rate_interval])", "legendFormat": "{{datname}}" } ] } ] }