From f9e4d41862ce70281ddae748bd206d377e99d939 Mon Sep 17 00:00:00 2001 From: avandras Date: Fri, 19 Jun 2026 09:21:49 +0200 Subject: [PATCH 1/2] Add reworked v13 health check dashboard --- grafana/postgres/v13/0_health_check.json | 7929 ++++++++++++++++++++++ 1 file changed, 7929 insertions(+) create mode 100644 grafana/postgres/v13/0_health_check.json diff --git a/grafana/postgres/v13/0_health_check.json b/grafana/postgres/v13/0_health_check.json new file mode 100644 index 0000000000..848cc7833e --- /dev/null +++ b/grafana/postgres/v13/0_health_check.json @@ -0,0 +1,7929 @@ +{ + "apiVersion": "dashboard.grafana.app/v2", + "kind": "Dashboard", + "metadata": { + "name": "health-check", + "namespace": "default", + "uid": "2a7bec29-276b-4a7e-8aff-85d798d4a198", + "resourceVersion": "1781768932208986", + "generation": 13, + "creationTimestamp": "2026-06-08T13:16:38Z", + "labels": { + "grafana.app/deprecatedInternalID": "1324846417690624" + }, + "annotations": { + "grafana.app/createdBy": "user:afoipfjig8k5cf", + "grafana.app/folder": "efoipikg7bjswc", + "grafana.app/message": "Add max conn count panel", + "grafana.app/saved-from-ui": "Grafana v13.0.2 (3fcdbc5a)", + "grafana.app/updatedBy": "user:afoipfjig8k5cf", + "grafana.app/updatedTimestamp": "2026-06-18T07:48:52Z", + "grafana.app/folderTitle": "v13 test", + "grafana.app/folderUrl": "/dashboards/f/efoipikg7bjswc/v13-test" + } + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "grafana" + }, + "spec": {} + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "builtIn": true + } + } + ], + "cursorSync": "Off", + "description": "Current and avg. KPI-s. Expects 'get_load_average' and 'backends' helpers to be installed on the monitored DB.", + "editable": true, + "elements": { + "panel-12": { + "kind": "Panel", + "spec": { + "id": 12, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Brought to you by\n\n[![Cybertec – The PostgreSQL Database Company](https://www.cybertec-postgresql.com/wp-content/uploads/2025/02/cybertec-logo-white-blue.svg)](https://www.cybertec-postgresql.com/en/)\n", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-13": { + "kind": "Panel", + "spec": { + "id": 13, + "title": "TX rollback % (avg.)", + "description": "", + "links": [ + { + "title": "'DB overview :: Rollback Ratio' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=8&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT max((roll - roll_lag) / ((roll - roll_lag) + (comm - comm_lag))::numeric) * 100 AS tx_rollback_rate\n FROM (\n SELECT(data->>'xact_rollback')::int8 AS roll, \n lag((data->>'xact_rollback')::int8) OVER w AS roll_lag,\n (data->>'xact_commit')::int8 AS comm, \n lag((data->>'xact_commit')::int8) OVER w AS comm_lag\n FROM db_stats\n WHERE $__timeFilter(time)\n AND dbname = '$dbname'\n WINDOW w AS (ORDER BY time)\n ) x\n WHERE comm > comm_lag OR roll > roll_lag", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 1, + "min": 0, + "max": 100, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 0.5, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 1, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-14": { + "kind": "Panel", + "spec": { + "id": 14, + "title": "WAL folder size", + "description": "Transaction Log Folder size. Assumes get_wal_size helper being installed. 1/10 GB Warn / 50 Error thresholds by default", + "links": [ + { + "title": "DB overview :: WAL panel", + "url": "/d/db-overview?$__all_variables&viewPanel=10&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "cpu_load", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT\n (data->>'wal_size_b')::float8 AS wal_size\nFROM\n wal_size\nWHERE\n $__timeFilter(time) \n AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "load_5min" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^wal_size$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1000000000, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 10000000000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-15": { + "kind": "Panel", + "spec": { + "id": 15, + "title": "Active queries", + "description": "", + "links": [ + { + "title": "'DB overview :: backends' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=11&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (data->>'active')::int AS active_cnt\nFROM backends\nWHERE $__timeFilter(time) AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "numbackends" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^active_cnt$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "dark-yellow" + }, + { + "value": 5, + "color": "dark-orange" + }, + { + "value": 10, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-16": { + "kind": "Panel", + "spec": { + "id": 16, + "title": "QPS (avg.)", + "description": "Queries per Second based on \"pg_stat_statements\" extension info. < 0.1 Error / < 1 Warning thresholds by default", + "links": [ + { + "title": "'DB overview Unprivileged / Developer :: QPS' panel", + "url": "/d/db-overview-developer?$__all_variables&viewPanel=15&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "cpu_load", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT avg( (c - c_lag) / extract(epoch FROM time - time_lag) ) AS qps\n FROM (\n SELECT (data->>'calls')::int8 AS c, \n lag((data->>'calls')::int8) OVER w AS c_lag,\n time, \n lag(time) OVER w AS time_lag\n FROM stat_statements_calls\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (order by time) \n ) x\n WHERE c >= c_lag AND time > time_lag", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "load_5min" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^qps$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#d44a3a" + }, + { + "value": 0.1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 1, + "color": "#28781e" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-17": { + "kind": "Panel", + "spec": { + "id": 17, + "title": "Query runtime (avg.)", + "description": "Average query runtime based on \"pg_stat_statements\"", + "links": [ + { + "title": "'DB overview:: Query runtime' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=12&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "cpu_load", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT avg(CASE WHEN c = c_lag THEN 0 ELSE (tt - tt_lag)::numeric / (c - c_lag) END) AS avg_query_runtime\n FROM (\n SELECT (data->>'total_time')::float8 AS tt, \n lag((data->>'total_time')::float8) OVER w AS tt_lag,\n (data->>'calls')::int8 AS c, \n lag((data->>'calls')::int8) OVER w AS c_lag\n FROM stat_statements_calls\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW W AS (ORDER BY time)\n ) x\n WHERE c >= c_lag AND tt >= tt_lag\n ORDER by 1 desc\n LIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "load_5min" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "ms", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 500, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 5000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-18": { + "kind": "Panel", + "spec": { + "id": 18, + "title": "Instance uptime", + "description": "Time from last Postgres process restart. < 5m Error, < 30m Warn thresholds by default", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (data->>'postmaster_uptime_s')::int AS uptime\nFROM wal\nWHERE $__timeFilter(time) AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "postmaster_uptime_s" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^uptime$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "dtdurations", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#d44a3a" + }, + { + "value": 300, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 1800, + "color": "#28781e" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-19": { + "kind": "Panel", + "spec": { + "id": 19, + "title": "WAL archiving status", + "description": "Based on pg_stat_archiver. N/A when archiving is not enabled.", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "365d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "archiver", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (data->>'is_failing_int')::int AS is_failing\nFROM archiver\nWHERE $__timeFilter(time)\n AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "is_failing_int" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "none", + "decimals": 0, + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "OK", + "index": 1 + }, + "1": { + "text": "FAILING", + "index": 0 + } + } + }, + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "no archiving", + "index": 2 + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-20": { + "kind": "Panel", + "spec": { + "id": 20, + "title": "Table changes", + "description": "Number of DDL changes i.e. new or changed tables, columns, functions etc. >1 Warn thresholds by default", + "links": [ + { + "title": "'DDL / Config change events' dash", + "url": "/d/change-events?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1h" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_changes", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT count(*)\nFROM table_changes\nWHERE $__timeFilter(time)\n AND dbname = '$dbname'\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "event" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "0", + "color": "#28781e" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": null, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-21": { + "kind": "Panel", + "spec": { + "id": 21, + "title": "Shared buffers hit %", + "description": "Shared buffers is the Postgres-managed cache. 90%+ is what you normally want to see for good performance.", + "links": [ + { + "title": "Open 'DB overview :: share'd buffers ' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=8&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT ((hit - hit_lag) / ((hit - hit_lag) + (read - read_lag))::numeric) * 100 AS cache_hit_ratio\n FROM (\n SELECT (data->>'blks_hit')::int8 AS hit, \n lag((data->>'blks_hit')::int8) OVER w AS hit_lag,\n (data->>'blks_read')::int8 AS read, \n lag((data->>'blks_read')::int8) OVER w AS read_lag\n FROM db_stats\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (ORDER BY time)\n ) x\n WHERE hit > hit_lag OR read > read_lag\n ORDER by 1", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 1, + "min": 0, + "max": 100, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "0", + "color": "#d44a3a" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#d44a3a" + }, + { + "value": 50, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 90, + "color": "#28781e" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-22": { + "kind": "Panel", + "spec": { + "id": 22, + "title": "Config change events", + "description": "Server configuration changes. >1 Warn thresholds by default", + "links": [ + { + "title": "'DDL / Config change events' dash", + "url": "/d/change-events?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1h" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_changes", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT count(*) AS changes_cnt\nFROM configuration_changes\nWHERE $__timeFilter(time)\n AND dbname = '$dbname'\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "event" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^changes_cnt$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "0", + "color": "#28781e" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": null, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-24": { + "kind": "Panel", + "spec": { + "id": 24, + "title": "DATADIR disk space left", + "description": "Assumes get_psutil_disk wrapper being installed. 10/50GB Warn/Error thresholds by default", + "links": [ + { + "title": "Open 'System Stats :: Free disk ' panel", + "url": "/d/system-stats?$__all_variables&viewPanel=8&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1h" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_changes", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (data->>'free')::int8 AS free_space\n FROM psutil_disk\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n AND tag_data->>'dir_or_tablespace' = 'data_directory'\n ORDER BY 1 desc\n LIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "event" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "0", + "color": "#d44a3a" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#d44a3a" + }, + { + "value": 10000000, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 50000000, + "color": "#28781e" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-25": { + "kind": "Panel", + "spec": { + "id": 25, + "title": "DB size (last)", + "description": "Size for selected DB only", + "links": [ + { + "title": "DB overview :: DB size panel", + "url": "/d/db-overview?$__all_variables&viewPanel=10&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1h" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (data->>'size_b')::int8 AS size\nFROM db_size\nWHERE $__timeFilter(time)\n AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "postmaster_uptime_s" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^size$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-26": { + "kind": "Panel", + "spec": { + "id": 26, + "title": "Checkpoints requested", + "description": "Checkpoints should normally be performed by the background \"Checkpointer\" process. If seeing high numbers then adjusting server configuration is recommended.", + "links": [ + { + "title": "Checkpointer / Bgwriter / Block IO Stats", + "url": "/d/checkpointer-bgwriter-stats?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "365d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "bgwriter", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT coalesce(sum(req - req_lag), 0) AS requested_cnt\n FROM (\n SELECT (data->>'checkpoints_req')::int as req,\n lag((data->>'checkpoints_req')::int) OVER(ORDER BY time) AS req_lag\n FROM bgwriter\n WHERE $__timeFilter(time)\n AND dbname = '$dbname'\n ) x\n WHERE req > req_lag", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "checkpoints_req" + ], + "type": "field" + }, + { + "params": [], + "type": "spread" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "diff" + ], + "fields": "/^requested_cnt$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "none", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 2, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-27": { + "kind": "Panel", + "spec": { + "id": 27, + "title": "Approx. table bloat", + "description": "Estimated extra space held by tables (excluding indexes) that would disappear after \"compacting\".", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT\n (data->>'approx_table_bloat_b')::int8 AS bloat\nFROM\n table_bloat_approx_summary_sql\nWHERE\n $__timeFilter(time)\n AND dbname = '$dbname'\nORDER BY 1 DESC\nLIMIT 1\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "total_relation_size_b" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "timeFrom": "1d", + "maxDataPoints": 100, + "hideTimeOverride": true + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^bloat$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-28": { + "kind": "Panel", + "spec": { + "id": 28, + "title": "Instance role", + "description": "PRIMARY - accepting writes, REPLICA - read-only", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT (data->>'in_recovery_int')::int\nFROM wal\nWHERE $__timeFilter(time) AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "none", + "decimals": 0, + "mappings": [ + { + "type": "value", + "options": { + "1": { + "text": "REPLICA" + } + } + }, + { + "type": "value", + "options": { + "0": { + "text": "PRIMARY" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 2, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-29": { + "kind": "Panel", + "spec": { + "id": 29, + "title": "FIXME in case #1446 gets merged Invalid / duplicate indexes", + "description": "Invalid indexes should be dropped as they're updated during DML operations but cannot be used to speed up queries. \n\nIn case multiple indexes of the same structure, Postgres will use the smallest, so the others can be dropped. \n\n'N/A' is displayed both when there are no Invalid/duplicate indexes or no metrics data for recommendations.\n\nRequires `reco_drop_index` metric.", + "links": [ + { + "title": "\"Index overview\" dashboard", + "url": "/d/index-overview", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "WITH q_invalid AS (\n select count(*) as cnt\n from recommendations\n where\n time = (\n select max(time) from recommendations \n where $__timeFilter(time) AND dbname = '$dbname' AND \n tag_data->>'reco_topic' = 'drop_index' AND tag_data->>'issue_type' = 'invalid'\n )\n AND dbname = '$dbname' AND tag_data->>'reco_topic' = 'drop_index' AND tag_data->>'issue_type' = 'invalid'\n)\nSELECT\n sum((data->>'duplicate_count')::int8) + (select cnt from q_invalid)::int8\nFROM\n recommendations\nWHERE\n time = (\n select max(time) from recommendations\n where $__timeFilter(time) AND dbname = '$dbname' AND \n tag_data->>'reco_topic' = 'drop_index' AND tag_data->>'issue_type' = 'duplicate'\n )\n AND dbname = '$dbname' AND tag_data->>'reco_topic' = 'drop_index' AND tag_data->>'issue_type' = 'duplicate'\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "total_relation_size_b" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 2, + "color": "#d44a3a" + } + ] + }, + "noValue": "N/A" + }, + "overrides": [] + } + } + } + } + }, + "panel-30": { + "kind": "Panel", + "spec": { + "id": 30, + "title": "Autovacuum issues", + "description": "Autovacuum disabled globally or per table. This can lead to stale statistics or bloated tables, both adversely affecting performance.", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "time_series", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT 0 as time,\n sum(count) AS issues_count\nFROM (\n SELECT count\n FROM (\n SELECT CASE WHEN data->>'autovacuum' = 'off' THEN 1 ELSE 0 END AS count\n FROM settings\n WHERE dbname = '$dbname'\n AND time > now() - '1d'::interval\n ORDER BY time DESC\n LIMIT 1\n ) AS s\n \n UNION ALL\n\n SELECT count(*)\n FROM table_stats\n WHERE dbname = '$dbname'\n AND time = (SELECT max(time) FROM table_stats WHERE dbname = '$dbname')\n AND (data->>'no_autovacuum')::int = 1\n ) x;", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "total_relation_size_b" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^issues_count$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 10, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-32": { + "kind": "Panel", + "spec": { + "id": 32, + "title": "Longest query runtime", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT max((data->>'longest_query_seconds')::numeric)\n FROM backends\n WHERE $__timeFilter(time) AND dbname = '$dbname'", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "ms", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 30, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 300, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-33": { + "kind": "Panel", + "spec": { + "id": 33, + "title": "\"Idle in TX\" count", + "description": "Transactions opened but where no queries are being executed.", + "links": [ + { + "title": "'DB overview :: Backends' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=11&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "backends", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT max((data->>'idleintransaction')::int) AS idle_in_tx\n FROM backends\n WHERE $__timeFilter(time) AND dbname = '$dbname'", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "idleintransaction" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^idle_in_tx$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 5, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-34": { + "kind": "Panel", + "spec": { + "id": 34, + "title": "Blocked sessions", + "description": "Max number of queries waiting on resources locked by other sessions. 1 Warn / 5 Err thresholds by default", + "links": [ + { + "title": "'Lock details' dashboard", + "url": "/d/lock-details?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "backends", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT max((data->>'waiting')::int) AS waiting_cnt\nFROM backends\nWHERE $__timeFilter(time) AND dbname = '$dbname'", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "waiting" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^waiting_cnt$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 5, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-35": { + "kind": "Panel", + "spec": { + "id": 35, + "title": "Longest autovacuum run", + "description": "Long running autovacuum processes can hint at workload or configuration problems", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawSql": "", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "dtdurations", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 60, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 300, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-36": { + "kind": "Panel", + "spec": { + "id": 36, + "title": "WAL bytes/s (avg.)", + "description": "Transaction logs generation velocity.", + "links": [ + { + "title": "DB overview :: WAL panel", + "url": "/d/db-overview?$__all_variables&viewPanel=10&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT avg((wal - wal_lag) / (etime - lag_etime)) AS wal_rate\n FROM (\n SELECT (data->>'xlog_location_b')::int8 AS wal, \n lag((data->>'xlog_location_b')::int8) OVER w AS wal_lag,\n extract(epoch from time) AS etime,\n lag(extract(epoch from time)) OVER w AS lag_etime,\n time\n FROM wal\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (ORDER BY time)\n ) x\nWHERE wal >= wal_lag AND etime > lag_etime", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1000000, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 16000000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-37": { + "kind": "Panel", + "spec": { + "id": 37, + "title": "Temp. bytes/s (avg.)", + "description": "Postgres writes temporary files to disk when sorting / grouping big amounts of data that doesn't fit into \"work_mem\". 10/100 MB Warn / Error by default", + "links": [ + { + "title": "DB overview", + "url": "/d/db-overview?$__all_variables&viewPanel=19&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "dataset": "pgwatch_metrics", + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT avg(CASE WHEN tb - tb_lag > 0 THEN (tb - tb_lag) / (etime - lag_etime) ELSE 0 END) AS temp_bytes_per_hour\n FROM (\n SELECT (data->>'temp_bytes')::int8 AS tb, lag((data->>'temp_bytes')::int8) OVER w AS tb_lag,\n (extract(epoch from time))::int8 AS etime,\n (lag(extract(epoch from time)) OVER w)::int8 AS lag_etime\n FROM db_stats\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (ORDER BY time)\n ) x\n WHERE tb >= tb_lag AND etime > lag_etime", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10000000, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 100000000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-39": { + "kind": "Panel", + "spec": { + "id": 39, + "title": "Seq. scans on >100 MB tables per minute (avg.)", + "description": "Frequent sequential scans on bigger tables should usually be avoided. Warn / Error thresholds: 10 / 100", + "links": [ + { + "title": "'Tables Top :: Most scans' panel", + "url": "/d/tables-top?$__all_variables&viewPanel=4&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "5m" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT sum((scan - scan_lag) * 60 / extract(epoch FROM (time - time_lag))) AS scan_count\n FROM (\n SELECT time, \n lag(time) OVER w AS time_lag,\n (data->>'seq_scan')::int8 AS scan, \n lag((data->>'seq_scan')::int8) OVER w AS scan_lag\n FROM table_stats\n WHERE $__timeFilter(time)\n AND dbname = '$dbname'\n AND (data->>'table_size_b')::int8 > 100000000\n WINDOW w AS (PARTITION BY tag_data->>'table_full_name' ORDER BY time)\n ) x\nWHERE scan > scan_lag AND time > time_lag", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "seq_scan" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + }, + { + "params": [ + "1m" + ], + "type": "non_negative_derivative" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^scan_count$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "0", + "index": 0 + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 100, + "color": "#d44a3a" + } + ] + }, + "noValue": "0" + }, + "overrides": [] + } + } + } + } + }, + "panel-4": { + "kind": "Panel", + "spec": { + "id": 4, + "title": "Inactive repl. slots", + "description": "Inactive replication slots accumulate WAL files, potentially until disk space runs out. Re-animate the replica or use pg_drop_replication_slot() to remove the slot so that Postgres can delete the unneeded WALs.", + "links": [ + { + "title": "'Replication lag' dashboard", + "url": "/d/replication?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1m" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "replication_slots", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT sum((data->>'non_active_int')::int) AS slot_count\n FROM replication_slots\n WHERE time = (SELECT max(time) FROM replication_slots WHERE $__timeFilter(time) AND dbname = '$dbname')\n AND dbname = '$dbname'\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "active" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^slot_count$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "none", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "#bf1b00" + }, + { + "value": 1000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-42": { + "kind": "Panel", + "spec": { + "id": 42, + "title": "Backup running since", + "description": "Based on pg_backup_start_time() [9.3+] function. N/A if no backup in progress.", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "backends", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT\n max((data->>'backup_duration_s')::int8) AS backup_duration\nFROM\n db_stats\nWHERE\n $__timeFilter(time)\n and dbname = '$dbname'", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "max_xmin_age_tx" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "dtdurations", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 3600, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 36000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-43": { + "kind": "Panel", + "spec": { + "id": 43, + "title": "Oldest TX age", + "description": "In TX count, both from sessions and replication slots. Holds back vacuum.", + "links": [ + { + "title": "'Replication lag' dashboard", + "url": "/d/replication?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "365d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "replication_slots", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT max(xmin) AS max_xmin\nFROM (\n SELECT max((data->>'xmin_age_tx')::int8) AS xmin\n FROM replication_slots\n WHERE time = (SELECT max(time) \n FROM replication_slots\n WHERE $__timeFilter(time)\n AND dbname = '$dbname')\n AND dbname = '$dbname' \n\n UNION ALL\n\n SELECT max((data->>'max_xmin_age_tx')::int8) AS xmin\n FROM backends\n WHERE time = (SELECT max(time)\n FROM backends\n WHERE $__timeFilter(time)\n AND dbname = '$dbname')\n AND dbname = '$dbname'\n) x", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "max_xmin_age_tx" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^max_xmin$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10000, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 100000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-44": { + "kind": "Panel", + "spec": { + "id": 44, + "title": "PG version", + "description": "\"SHOW server_version_num;\"\n110005 => 11.5", + "links": [ + { + "title": "Postgres Version Overview", + "url": "/d/postgres-version-overview?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1m" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "replication_slots", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "select split_part(data->>'server_version'::text, ' ', 1) as server_version\nfrom settings \nwhere dbname = '$dbname' and $__timeFilter(time) \norder by time \ndesc limit 1;", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "active" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "timeFrom": "6h", + "maxDataPoints": 100, + "hideTimeOverride": true + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^server_version$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "none", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#C4162A" + }, + { + "value": 14, + "color": "#FA6400" + }, + { + "value": 18, + "color": "#28781e" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-45": { + "kind": "Panel", + "spec": { + "id": 45, + "title": "Connections used %", + "description": "", + "links": [ + { + "title": "'DB overview :: backends' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=11&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "WITH s(max_connections) AS (\n SELECT (data->>'max_connections')::int\n FROM settings\n WHERE $__timeFilter(time) AND dbname = '$dbname'\n ORDER BY time DESC\n LIMIT 1\n)\nSELECT round(((b.data->>'numbackends')::float / s.max_connections) * 100) AS conn_used_pct, max_connections\nFROM db_stats b, s\nWHERE $__timeFilter(b.time) AND b.dbname = '$dbname'\nORDER BY b.time DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "numbackends" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "timeFrom": "6h", + "maxDataPoints": 100, + "hideTimeOverride": true + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^conn_used_pct$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 50, + "color": "#FA6400" + }, + { + "value": 75, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-46": { + "kind": "Panel", + "spec": { + "id": 46, + "title": "Max. replication lag", + "description": "\"Apply\" (data made visible to queries on replica) lag in bytes", + "links": [ + { + "title": "'Replication lag' dashboard", + "url": "/d/replication?$__all_variables", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1m" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "replication_slots", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT\n max((data->>'replay_lag_b')::int8) AS replay_lag\nFROM\n replication\nWHERE\n $__timeFilter(time)\n AND dbname = '$dbname'\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "active" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^replay_lag$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1000000, + "color": "#FA6400" + }, + { + "value": 10000000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-47": { + "kind": "Panel", + "spec": { + "id": 47, + "title": "Max. table FREEZE age", + "description": "Max. age since last VACUUM FREEZE. Could hint at problems when going into 100s of millions", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "365d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "replication_slots", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT\n max((data->>'tx_freeze_age')::int8) AS tx_freeze_age\nFROM\n table_stats\nWHERE\n $__timeFilter(time)\n and dbname = '$dbname'", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "max_xmin_age_tx" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^tx_freeze_age$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 100000000, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 500000000, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-48": { + "kind": "Panel", + "spec": { + "id": 48, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### The preset threshold values (green / yellow / red) should be reviewed / adjusted!", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-49": { + "kind": "Panel", + "spec": { + "id": 49, + "title": "Established connections (total)", + "description": "Total number of sessions established to this database during the interval set in the dashboard", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT max((data->>'sessions')::int8) - min((data->>'sessions')::int8) AS established\r\n FROM db_stats \r\n WHERE dbname = '$dbname' AND $__timeFilter(time) \r\n ORDER BY 1", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^established$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 100, + "color": "red" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-50": { + "kind": "Panel", + "spec": { + "id": 50, + "title": "JIT %", + "description": "Percentage of total query execution time spent in JIT (requires stat_statements_jit metric)", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "365d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "stat_statements_jit", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (sum(total_jit - total_jit_lag) / sum(total_time - total_time_lag)) * 100 AS pct\n FROM\n (\n SELECT time,\n (data->>'jit_generation_time')::float8 AS total_jit, \n lag((data->>'jit_generation_time')::float8) OVER w AS total_jit_lag,\n (data->>'total_time')::float8 AS total_time, \n lag((data->>'total_time')::float8) OVER w AS total_time_lag\n FROM stat_statements\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW W AS (ORDER BY time)\n )\n WHERE total_time > total_time_lag", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^pct$/", + "limit": 1, + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 2, + "min": 0, + "max": 100, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 1, + "color": "orange" + }, + { + "value": 25, + "color": "red" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-51": { + "kind": "Panel", + "spec": { + "id": 51, + "title": "Total index size", + "description": "Total size of user indexes for the selected DB. requires db_size metric.", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [], + "measurement": "db_size", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (data->>'indexes_size_b')::int8\nFROM db_size\nWHERE $__timeFilter(time)\n AND dbname = '$dbname'\nORDER BY time DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [], + "sql": {}, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 1, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-52": { + "kind": "Panel", + "spec": { + "id": 52, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Overall state", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-53": { + "kind": "Panel", + "spec": { + "id": 53, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Autovacuum", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-54": { + "kind": "Panel", + "spec": { + "id": 54, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-55": { + "kind": "Panel", + "spec": { + "id": 55, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### WAL and replication", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-56": { + "kind": "Panel", + "spec": { + "id": 56, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Connections", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-57": { + "kind": "Panel", + "spec": { + "id": 57, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Miscellaneous", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-58": { + "kind": "Panel", + "spec": { + "id": 58, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Disk usage", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-60": { + "kind": "Panel", + "spec": { + "id": 60, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-63": { + "kind": "Panel", + "spec": { + "id": 63, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Change rate", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-64": { + "kind": "Panel", + "spec": { + "id": 64, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Transactions", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-65": { + "kind": "Panel", + "spec": { + "id": 65, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Queries", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-67": { + "kind": "Panel", + "spec": { + "id": 67, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### Tables and indexes", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-69": { + "kind": "Panel", + "spec": { + "id": 69, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-7": { + "kind": "Panel", + "spec": { + "id": 7, + "title": "TPS (avg.)", + "description": "Transactions per second", + "links": [ + { + "title": "'DB overview Unprivileged / Developer :: TPS' panel", + "url": "/d/db-overview-developer?$__all_variables&viewPanel=15&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT avg(((roll - roll_lag) + (comm - comm_lag)) / extract(epoch FROM (time - time_lag))) AS tps\n FROM (\n SELECT time, \n lag(time) OVER w AS time_lag,\n (data->>'xact_rollback')::int8 AS roll, \n lag((data->>'xact_rollback')::int8) OVER w AS roll_lag,\n (data->>'xact_commit')::int8 AS comm, \n lag((data->>'xact_commit')::int8) OVER w AS comm_lag\n FROM db_stats\n WHERE $__timeFilter(time)\n AND dbname = '$dbname'\n WINDOW w AS (ORDER BY time)\n ) x\nWHERE (comm > comm_lag OR roll > roll_lag) AND time > time_lag", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "xact_commit" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^tps$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 1, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#d44a3a" + }, + { + "value": 0.1, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 1, + "color": "#28781e" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-71": { + "kind": "Panel", + "spec": { + "id": 71, + "title": "DB size change (%)", + "description": "", + "links": [ + { + "title": "'DB overview :: backends' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=10&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT (last_value - first_value) / first_value::numeric * 100 AS size_diff_pct\n FROM (\n SELECT first_value((data->>'size_b')::int8) OVER w,\n last_value((data->>'size_b')::int8) OVER w\n FROM db_size\n WHERE dbname = '$dbname' and $__timeFilter(time)\n WINDOW w AS (\n ORDER BY time ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING\n )\n) x\nORDER BY 1 DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "numbackends" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "timeFrom": "6h", + "maxDataPoints": 100, + "hideTimeOverride": true + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^size_diff_pct$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10, + "color": "#FA6400" + }, + { + "value": 50, + "color": "#d44a3a" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-72": { + "kind": "Panel", + "spec": { + "id": 72, + "title": "DB size change", + "description": "", + "links": [ + { + "title": "'DB overview :: backends' panel", + "url": "/d/db-overview?$__all_variables&viewPanel=10&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "db_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT last_value - first_value AS size_diff\n FROM (\n SELECT first_value((data->>'size_b')::int8) OVER w,\n last_value((data->>'size_b')::int8) OVER w\n FROM db_size\n WHERE dbname = '$dbname' and $__timeFilter(time)\n WINDOW w AS (\n ORDER BY time ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING\n )\n) x\nORDER BY 1 DESC\nLIMIT 1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "numbackends" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [ + { + "key": "dbname", + "operator": "=~", + "value": "/^$dbname$/" + } + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "timeFrom": "6h", + "maxDataPoints": 100, + "hideTimeOverride": true + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^size_diff$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 0, + "mappings": [ + { + "type": "special", + "options": { + "match": "null", + "result": { + "text": "N/A" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "transparent" + } + ] + } + }, + "overrides": [] + } + } + } + } + }, + "panel-73": { + "kind": "Panel", + "spec": { + "id": 73, + "title": "INSERT/min (avg.)", + "description": "On non-temporary tables", + "links": [ + { + "title": "'Tables Top :: Inserts' panel", + "url": "/d/tables-top?$__all_variables&viewPanel=6&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT avg(((ins - ins_lag) * 60) / extract(epoch FROM time - time_lag)) AS ins_per_min\n FROM (\n SELECT (data->>'tup_inserted')::int8 AS ins, \n lag((data->>'tup_inserted')::int8) OVER w AS ins_lag,\n time, \n lag(time) OVER w AS time_lag\n FROM db_stats\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (ORDER BY time)\n ) AS x\n WHERE ins >= ins_lag AND time > time_lag", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "total_relation_size_b" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^ins_per_min$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 25, + "color": "#d44a3a" + } + ] + }, + "noValue": "N/A" + }, + "overrides": [] + } + } + } + } + }, + "panel-74": { + "kind": "Panel", + "spec": { + "id": 74, + "title": "UPDATE/min (avg.)", + "description": "On non-temporary tables", + "links": [ + { + "title": "'Tables Top :: Updates' panel", + "url": "/d/tables-top?$__all_variables&viewPanel=7&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT avg(((upd - upd_lag) * 60) / extract(epoch FROM time - time_lag)) AS upd_per_min\n FROM (\n SELECT (data->>'tup_updated')::int8 AS upd, \n lag((data->>'tup_updated')::int8) OVER w AS upd_lag,\n time, \n lag(time) OVER w AS time_lag\n FROM db_stats\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (ORDER BY time)\n ) AS x\n WHERE upd >= upd_lag AND time > time_lag\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "total_relation_size_b" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^upd_per_min$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 25, + "color": "#d44a3a" + } + ] + }, + "noValue": "N/A" + }, + "overrides": [] + } + } + } + } + }, + "panel-75": { + "kind": "Panel", + "spec": { + "id": 75, + "title": "DELETE/min (avg.)pd", + "description": "On non-temporary tables", + "links": [ + { + "title": "'Tables Top :: Deletes' panel", + "url": "/d/tables-top?$__all_variables&viewPanel=8&fullscreen", + "targetBlank": true + } + ], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "group": [], + "groupBy": [ + { + "params": [ + "1d" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "table_stats", + "metricColumn": "none", + "orderByTime": "ASC", + "policy": "default", + "rawQuery": true, + "rawSql": "SELECT avg(((del - del_lag) * 60) / extract(epoch FROM time - time_lag)) AS del_per_min\n FROM (\n SELECT (data->>'tup_deleted')::int8 AS del, \n lag((data->>'tup_deleted')::int8) OVER w AS del_lag,\n time, \n lag(time) OVER w AS time_lag\n FROM db_stats\n WHERE dbname = '$dbname' AND $__timeFilter(time)\n WINDOW w AS (ORDER BY time)\n ) AS x\n WHERE del >= del_lag AND time > time_lag\n", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "total_relation_size_b" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "tags": [], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": { + "maxDataPoints": 100 + } + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^del_per_min$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "decimals": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 10, + "color": "rgba(237, 129, 40, 0.89)" + }, + { + "value": 25, + "color": "#d44a3a" + } + ] + }, + "noValue": "N/A" + }, + "overrides": [] + } + } + } + } + }, + "panel-77": { + "kind": "Panel", + "spec": { + "id": 77, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-78": { + "kind": "Panel", + "spec": { + "id": 78, + "title": "", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "text", + "version": "13.0.2", + "spec": { + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + } + } + }, + "transparent": true + } + }, + "panel-79": { + "kind": "Panel", + "spec": { + "id": 79, + "title": "Max. number of connections", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT max((data->>'numbackends')) AS max_conn_count\r\n FROM db_stats \r\n WHERE dbname = '$dbname' AND $__timeFilter(time) \r\n ORDER BY 1", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "13.0.2", + "spec": { + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^max_conn_count$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "unit": "short", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "#28781e" + }, + { + "value": 100, + "color": "red" + } + ] + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "RowsLayout", + "spec": { + "rows": [ + { + "kind": "RowsLayoutRow", + "spec": { + "title": "Instance status", + "collapse": false, + "hideHeader": false, + "fillScreen": false, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 3, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-52" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 0, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-28" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 0, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-18" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 0, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-44" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 18, + "y": 0, + "width": 5, + "height": 6, + "element": { + "kind": "ElementReference", + "name": "panel-54" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 2, + "width": 3, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-53" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 2, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-35" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 2, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-30" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 2, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-27" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 4, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-47" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 4, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-43" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 4, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-60" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 6, + "width": 3, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-55" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-19" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-14" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-46" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 18, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 8, + "width": 3, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-56" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 8, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-79" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 8, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-45" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 8, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-49" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 18, + "y": 8, + "width": 5, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-78" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 10, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-15" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 10, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-34" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 10, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-77" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 12, + "width": 3, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-58" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 12, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-25" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 12, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-71" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 12, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-72" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 18, + "y": 12, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-24" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 14, + "width": 3, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-57" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 14, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-42" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 14, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-22" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 14, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-26" + } + } + } + ] + } + } + } + }, + { + "kind": "RowsLayoutRow", + "spec": { + "title": "DB traffic", + "collapse": false, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 3, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-63" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 0, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-73" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 0, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-74" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 0, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-75" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 2, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-36" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 2, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-37" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 2, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-69" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 4, + "width": 3, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-64" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 4, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-7" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 4, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-13" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 4, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-33" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 6, + "width": 3, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-65" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-16" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-17" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 6, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-32" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 8, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-21" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 8, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-39" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 8, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-50" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 10, + "width": 3, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-67" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 3, + "y": 10, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-20" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 10, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-29" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 13, + "y": 10, + "width": 5, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-51" + } + } + } + ] + } + } + } + }, + { + "kind": "RowsLayoutRow", + "spec": { + "title": "Colophon", + "collapse": false, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 12, + "height": 7, + "element": { + "kind": "ElementReference", + "name": "panel-12" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 12, + "y": 0, + "width": 12, + "height": 2, + "element": { + "kind": "ElementReference", + "name": "panel-48" + } + } + } + ] + } + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [ + "pgwatch" + ], + "timeSettings": { + "timezone": "browser", + "from": "now-30m", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "0. Health Check", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "dbname", + "current": { + "text": "", + "value": "" + }, + "label": "Source Name", + "hide": "dontHide", + "refresh": "onDashboardLoad", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "ffopxl0bi2tj4b" + }, + "spec": { + "editorMode": "code", + "format": "table", + "query": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics ORDER BY 1;", + "rawQuery": true, + "rawSql": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics ORDER BY 1;", + "refId": "SQLVariableQueryEditor-VariableQuery", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "regex": "", + "regexApplyTo": "value", + "sort": "disabled", + "definition": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics ORDER BY 1;", + "options": [], + "multi": false, + "includeAll": false, + "allowCustomValue": true + } + } + ] + } +} \ No newline at end of file From edff75f521fc43051e918c91075d8cc5dd558d7c Mon Sep 17 00:00:00 2001 From: avandras Date: Fri, 19 Jun 2026 09:54:26 +0200 Subject: [PATCH 2/2] Add a note about the grafana.ini amendment --- docs/tutorial/custom_installation.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/custom_installation.md b/docs/tutorial/custom_installation.md index f3a468ace5..c1b0b82445 100644 --- a/docs/tutorial/custom_installation.md +++ b/docs/tutorial/custom_installation.md @@ -205,7 +205,10 @@ Add databases to monitor via one of the methods: 2. Import the default postgres and/or prometheus dashboards from the [`grafana/`](https://github.com/cybertec-postgresql/pgwatch/tree/master/grafana) folder into your Grafana instance. !!! note - The default built-in dashboards expect `postgres/prometheus` data sources with uids `pgwatch-metrics/pgwatch-prometheus` by default. + The default built-in dashboards expect `postgres` or `prometheus` data sources with the default UIDs `pgwatch-metrics` or `pgwatch-prometheus`, respectively. + +!!! note + Starting from Grafana 12.4, a small adjustment to `grafana.ini` is needed for avoiding too small fonts for displayed values in some of the dashboards. Add `newPanelPadding = false` to the `[feature_toggles]` section. ## Next Steps