{ "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "datasource", "uid": "grafana" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "links": [], "panels": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "As per \"settings\" metric.", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "auto", "cellOptions": { "type": "auto" }, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "server_version_num" }, "properties": [ { "id": "unit", "value": "none" }, { "id": "custom.cellOptions", "value": { "type": "color-background" } }, { "id": "custom.align", "value": "left" }, { "id": "thresholds", "value": { "mode": "absolute", "steps": [ { "color": "rgba(245, 54, 54, 0.9)", "value": null }, { "color": "rgba(237, 129, 40, 0.89)", "value": 90400 }, { "color": "rgba(50, 172, 45, 0.97)", "value": 90600 } ] } } ] } ] }, "gridPos": { "h": 14, "w": 24, "x": 0, "y": 0 }, "id": 2, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": "", "reducer": [ "sum" ], "show": false }, "showHeader": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "table", "group": [], "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "measurement": "sproc_stats", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "SELECT top(\"spread\", \"function_full_name\", \"oid\", $top) FROM (SELECT spread(\"total_time\") FROM \"sproc_stats\" WHERE $timeFilter AND \"dbname\" = '$dbname' GROUP BY time(3650d), \"function_full_name\", \"oid\" fill(none) ) WHERE spread > 0", "rawQuery": true, "rawSql": "SELECT\n split_part(data->>'server_version'::text, ' ', 1) as server_version,\n (data->'server_version_num')::int8 as server_version_num,\n string_agg(DISTINCT dbname, ', ') as dbname \nFROM\n settings\nWHERE\n $__timeFilter(time)\n AND dbname IN ($dbname)\n AND (data->>'server_version_num')::int8 <= $lower_than_server_version_num\nGROUP BY 1, 2\nORDER BY 1", "refId": "A", "resultFormat": "table", "select": [ [ { "params": [ "total_time" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "Monitored DBs by version", "transformations": [ { "id": "merge", "options": { "reducers": [] } } ], "type": "table" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 14 }, "id": 8, "options": { "code": { "language": "plaintext", "showLineNumbers": false, "showMiniMap": false }, "content": "