Files
grafana-dashboards/postgresexporter.json
2025-12-05 11:12:21 +03:00

3754 lines
92 KiB
JSON

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 45,
"links": [],
"panels": [
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 4,
"panels": [],
"title": "Global",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Statements executed per Minute.\n\nSource: pg_stat_statements.calls",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "rgb(31, 120, 193)",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 0,
"y": 1
},
"id": 3,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((rate(pg_stat_statements_calls_total{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "",
"range": true,
"refId": "A"
}
],
"title": "Query rate",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Setting: shared_buffers in PostgreSQL.conf",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 4,
"x": 5,
"y": 1
},
"id": 6,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "pg_settings_shared_buffers_bytes{instance=\"$Instance\"}",
"legendFormat": "{{pod}}",
"range": true,
"refId": "A"
}
],
"title": "Shared Buffers",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Shared buffer hits vs reads from disc",
"fieldConfig": {
"defaults": {
"decimals": 2,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": 0
},
{
"color": "semi-dark-yellow",
"value": 80
},
{
"color": "semi-dark-green",
"value": 90
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 5,
"x": 9,
"y": 1
},
"id": 7,
"options": {
"minVizHeight": 75,
"minVizWidth": 75,
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"sizing": "auto"
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum(pg_stat_database_blks_hit{instance=~\"$Instance\"})/(sum(pg_stat_database_blks_hit{instance=~\"$Instance\"})+sum(pg_stat_database_blks_read{instance=~\"$Instance\"}))*100",
"refId": "A"
}
],
"title": "Shared Buffer Hits",
"type": "gauge"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Percentage of max_connections used",
"fieldConfig": {
"defaults": {
"decimals": 0,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 1,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-green",
"value": 0
},
{
"color": "semi-dark-yellow",
"value": 0.75
},
{
"color": "semi-dark-red",
"value": 0.9
}
]
},
"unit": "percentunit"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 5,
"x": 14,
"y": 1
},
"id": 8,
"options": {
"minVizHeight": 75,
"minVizWidth": 75,
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"last"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"sizing": "auto"
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum(pg_stat_database_numbackends)/max(pg_settings_max_connections)",
"refId": "A"
}
],
"title": "Connections used",
"type": "gauge"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Transaction committed vs rollbacked",
"fieldConfig": {
"defaults": {
"decimals": 2,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 1,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": 0
},
{
"color": "#EAB839",
"value": 0.75
},
{
"color": "semi-dark-green",
"value": 0.9
}
]
},
"unit": "percentunit"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 5,
"x": 19,
"y": 1
},
"id": 9,
"options": {
"minVizHeight": 75,
"minVizWidth": 75,
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"sizing": "auto"
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum(pg_stat_database_xact_commit{instance=\"$Instance\"})/(sum(pg_stat_database_xact_commit{instance=\"$Instance\"}) + sum(pg_stat_database_xact_rollback{instance=\"$Instance\"}))",
"refId": "A"
}
],
"title": "Commit Ratio",
"type": "gauge"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Transactions committed + roolback per minute\n\nSource: pg_stat_database,xact_commit + xact_rollback",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "rgb(31, 120, 193)",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 0,
"y": 5
},
"id": 1,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((rate(pg_stat_database_xact_commit{instance=\"$Instance\"}[$__interval_ms])))+sum((rate(pg_stat_database_xact_rollback{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "",
"range": true,
"refId": "A"
}
],
"title": "Transaction rate",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Max Replication lag behind master in seconds\n\nOnly available on a standby system.\n\nSource: pg_last_xact_replay_timestamp\n\nUse: pg_stat_replication for Details.",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "rgb(31, 120, 193)",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 4,
"x": 5,
"y": 5
},
"id": 11,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"max"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "max(pg_replication_lag_seconds{instance=\"$Instance\"})",
"interval": "",
"legendFormat": "",
"range": true,
"refId": "A"
}
],
"title": "Max Replication Lag",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 19,
"x": 0,
"y": 9
},
"id": 21,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"editorMode": "code",
"expr": "pg_stat_database_numbackends{datname=~\"$Database\", instance=~\"$Instance\"}",
"legendFormat": "{{datname}}",
"range": true,
"refId": "A"
}
],
"title": "Connections to bases",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Size of all databases in $Instance.\n\nSource: pg_database_size()",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "rgb(31, 120, 193)",
"mode": "fixed"
},
"decimals": 2,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 5,
"x": 19,
"y": 9
},
"id": 5,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum(pg_database_size_bytes{instance=\"$Instance\"})",
"range": true,
"refId": "A"
}
],
"title": "Total database size",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "View: pg_stat_activity\n",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 19,
"x": 0,
"y": 16
},
"id": 38,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"orientation": "auto",
"showValue": "auto",
"stacking": "none",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "12.1.0",
"targets": [
{
"editorMode": "code",
"exemplar": false,
"expr": "pg_stat_database_numbackends{datname=~\"$Database\", instance=~\"$Instance\"}",
"instant": true,
"legendFormat": "{{datname}}",
"range": false,
"refId": "A"
}
],
"title": "Connections by database ",
"type": "barchart"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 5,
"x": 19,
"y": 16
},
"id": 39,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {
"titleSize": 10
},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"editorMode": "code",
"expr": "sum(pg_settings_max_connections{instance=\"$Instance\"})",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Max Connections",
"type": "stat"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 23
},
"id": 20,
"panels": [],
"title": "Queries",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 24
},
"id": 40,
"options": {
"legend": {
"calcs": [
"mean",
"max",
"min"
],
"displayMode": "table",
"placement": "right",
"showLegend": true,
"sortBy": "Max",
"sortDesc": false
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"disableTextWrap": false,
"editorMode": "code",
"expr": "sum by(datname) (\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\nor\r\nsum by(datname) (\r\n irate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)",
"format": "time_series",
"fullMetaSearch": false,
"includeNullMetadata": true,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "__auto",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Statements Calls",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "queryid"
},
"properties": [
{
"id": "displayName",
"value": "Query ID"
},
{
"id": "custom.align"
},
{
"id": "unit"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "Calls/sec"
},
{
"id": "unit",
"value": "ops"
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 0
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 100
},
{
"color": "rgba(245, 54, 54, 0.9)",
"value": 1000
},
{
"value": 10000
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "instance"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "job"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "tier"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "type"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "query"
},
"properties": [
{
"id": "custom.width",
"value": 217
}
]
}
]
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 33
},
"id": 41,
"links": [
{
"url": "/"
}
],
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Query ID"
}
]
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"disableTextWrap": false,
"dsType": "influxdb",
"editorMode": "code",
"expr": "(\r\n sort_desc(\r\n topk(\r\n 10,\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n or irate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\n* on (queryid, instance)\r\ngroup_left(query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n",
"format": "table",
"fullMetaSearch": false,
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"includeNullMetadata": true,
"instant": true,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"useBackend": false
}
],
"title": "Most Called Queries",
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 43
},
"id": 42,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"disableTextWrap": false,
"editorMode": "builder",
"expr": "(sum by(datname) (rate(pg_stat_statements_seconds_total{datname=~\"$Database\", instance=\"$Instance\"}[$__interval_ms])) > 0) or (irate(pg_stat_statements_time_milliseconds{datname=~\"$datname\", instance=\"$host\"}[5m]))",
"format": "time_series",
"fullMetaSearch": false,
"includeNullMetadata": true,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "{{datname}}",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Total Duration of Queries",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 51
},
"id": 44,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"uid": "Prometheus"
},
"disableTextWrap": false,
"dsType": "influxdb",
"editorMode": "code",
"expr": "topk(\r\n 10,\r\n (\r\n rate(pg_stat_statements_seconds_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n /\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n)\r\n* on (queryid, instance)\r\ngroup_left(query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n",
"format": "table",
"fullMetaSearch": false,
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"includeNullMetadata": true,
"instant": true,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"useBackend": false
}
],
"title": "Average Runtime",
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 58
},
"id": 43,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"uid": "Prometheus"
},
"disableTextWrap": false,
"dsType": "influxdb",
"editorMode": "code",
"expr": "sort_desc(topk(10, rate(pg_stat_database_active_time_seconds_total{datname=~\"$Database\", instance=\"$Instance\"}[$__interval_ms])))",
"format": "table",
"fullMetaSearch": false,
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"includeNullMetadata": true,
"instant": true,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"useBackend": false
}
],
"title": "Queries Duration",
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "queryid"
},
"properties": [
{
"id": "displayName",
"value": "Query ID"
},
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align"
},
{
"id": "unit"
}
]
},
{
"matcher": {
"id": "byName",
"options": ""
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "Duration"
},
{
"id": "unit",
"value": "ms"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align"
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 65
},
"id": 45,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"uid": "Prometheus"
},
"disableTextWrap": false,
"dsType": "influxdb",
"editorMode": "code",
"expr": "(\r\n sort_desc(\r\n topk(\r\n 5,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_seconds_total{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n unless (\r\n topk(\r\n 20,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_time_milliseconds{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n)\r\n* on (queryid)\r\ngroup_left(instance, query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n",
"format": "table",
"fullMetaSearch": false,
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"includeNullMetadata": true,
"instant": false,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"useBackend": false
}
],
"title": "New Slow Queries for All Databases",
"type": "table"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 73
},
"id": 27,
"panels": [],
"title": "Transactions",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "1 Minute rate of transactions committed or rollback.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 74
},
"id": 14,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum ((delta(pg_stat_database_xact_commit[$__interval_ms])))",
"interval": "",
"legendFormat": "committed",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum ((delta(pg_stat_database_xact_rollback[$__interval_ms])))",
"hide": false,
"interval": "",
"legendFormat": "rollback",
"range": true,
"refId": "B"
}
],
"title": "Transactions",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Source: pg_stat_database",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 81
},
"id": 24,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((delta(pg_stat_database_tup_inserted{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "Inserts",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((delta(pg_stat_database_tup_updated{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "Updates",
"range": true,
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((delta(pg_stat_database_tup_deleted{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "Deletes",
"range": true,
"refId": "C"
}
],
"title": "Tuples inserts/updates/deletes",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 81
},
"id": 29,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"disableTextWrap": false,
"editorMode": "code",
"expr": "pg_stat_activity_max_tx_duration{instance=\"$Instance\"}",
"fullMetaSearch": false,
"includeNullMetadata": true,
"legendFormat": "{{instance}} / {{datname}} ({{state}})",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Longest transition",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "* blk_read_time: Time spent reading data file blocks by backends in this database, in milliseconds\n* blk_write_time: Time spent writing data file blocks by backends in this database, in milliseconds\n\ntrack_io_timings needs to be activated",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 88
},
"id": 25,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum ((rate(pg_stat_database_blk_read_time{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "blk_read_time",
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum ((rate(pg_stat_database_blk_write_time{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "blk_read_time",
"refId": "B"
}
],
"title": "I/O Read/Write time",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Source: pg_stat_database\n\n* tup_fetched: rows needed to satisfy queries\n* tup_returned: rows read/scanned",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 88
},
"id": 26,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((delta(pg_stat_database_tup_fetched{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "Fetched",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "sum((delta(pg_stat_database_tup_returned{instance=\"$Instance\"}[$__interval_ms])))",
"interval": "",
"legendFormat": "Returned",
"range": true,
"refId": "B"
}
],
"title": "Tuples fetched/returned",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 96
},
"id": 28,
"panels": [],
"repeat": "Database",
"title": "Database: $Database",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "rgb(31, 120, 193)",
"mode": "fixed"
},
"decimals": 2,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 97
},
"id": 35,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "pg_database_size_bytes{instance=\"$Instance\",datname=\"$Database\"}",
"range": true,
"refId": "A"
}
],
"title": "Database size",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Source: pg_stat_database",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 97
},
"id": 31,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "rate(pg_stat_database_tup_inserted{instance=\"$instance\",datname=\"$Database\"}[$__interval_ms])",
"interval": "",
"legendFormat": "Inserts",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "rate(pg_stat_database_tup_updated{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])",
"interval": "",
"legendFormat": "Updates",
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "rate(pg_stat_database_tup_deleted{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])",
"interval": "",
"legendFormat": "Deletes",
"refId": "C"
}
],
"title": "Tuples inserts/updates/deletes",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "1 Minute rate of transactions committed or rollback.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 105
},
"id": 30,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "delta(pg_stat_database_xact_commit{instance=\"$instance\",datname=\"$Database\"}[$__interval_ms])",
"interval": "",
"legendFormat": "committed",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "delta(pg_stat_database_xact_rollback{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])",
"hide": false,
"interval": "",
"legendFormat": "rollback",
"range": true,
"refId": "B"
}
],
"title": "Transactions",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Source: pg_locks",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 105
},
"id": 33,
"links": [
{
"title": "PostgreSQL Lock Modes",
"url": "https://www.postgresql.org/docs/12/explicit-locking.html#LOCKING-TABLES"
}
],
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum by (mode) (pg_locks_count{instance=\"$Instance\",datname=\"$Database\"})",
"legendFormat": "{{mode}}",
"refId": "A"
}
],
"title": "Locks by state",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Source: pg_stat_database\n\n* tup_fetched: rows needed to satisfy queries\n* tup_returned: rows read/scanned",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 113
},
"id": 32,
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "delta(pg_stat_database_tup_fetched{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])",
"interval": "",
"legendFormat": "Fetched",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"editorMode": "code",
"expr": "delta(pg_stat_database_tup_returned{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])",
"interval": "",
"legendFormat": "Returned",
"range": true,
"refId": "B"
}
],
"title": "Tuples fetched/returned",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"noValue": "No most called queries",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "queryid"
},
"properties": [
{
"id": "displayName",
"value": "Query ID"
},
{
"id": "custom.align"
},
{
"id": "unit"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "Calls/sec"
},
{
"id": "unit",
"value": "ops"
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 0
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 100
},
{
"color": "rgba(245, 54, 54, 0.9)",
"value": 1000
},
{
"value": 10000
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "job"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "tier"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "type"
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "query"
},
"properties": [
{
"id": "custom.width",
"value": 217
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 113
},
"id": 46,
"links": [
{
"url": "/"
}
],
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Query ID"
}
]
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"disableTextWrap": false,
"dsType": "influxdb",
"editorMode": "code",
"expr": "(\r\n sort_desc(\r\n topk(\r\n 10,\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n or irate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\n* on (queryid, instance)\r\ngroup_left(query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n",
"format": "table",
"fullMetaSearch": false,
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"includeNullMetadata": true,
"instant": true,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"useBackend": false
}
],
"title": "Most Called Queries",
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"description": "Source: pg_locks",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 121
},
"id": 34,
"links": [
{
"title": "PostgreSQL Lock Modes",
"url": "https://www.postgresql.org/docs/12/explicit-locking.html#LOCKING-TABLES"
}
],
"options": {
"dataLinks": [],
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"expr": "sum by (mode) (pg_locks_count{instance=\"$Instance\",datname=\"$Database\"})",
"legendFormat": "{{mode}}",
"refId": "A"
}
],
"title": "Locks by state",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prom"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"noValue": "No new slow queries",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "custom.hidden",
"value": true
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "queryid"
},
"properties": [
{
"id": "displayName",
"value": "Query ID"
},
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align"
},
{
"id": "unit"
}
]
},
{
"matcher": {
"id": "byName",
"options": ""
},
"properties": [
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "displayName",
"value": "Duration"
},
{
"id": "unit",
"value": "ms"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "query"
},
"properties": [
{
"id": "custom.width",
"value": 464
}
]
},
{
"matcher": {
"id": "byName",
"options": "instance"
},
"properties": [
{
"id": "custom.width",
"value": 61
}
]
},
{
"matcher": {
"id": "byName",
"options": "datname"
},
"properties": [
{
"id": "custom.width",
"value": 76
}
]
},
{
"matcher": {
"id": "byName",
"options": "user"
},
"properties": [
{
"id": "custom.width",
"value": 24
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 121
},
"id": 47,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"uid": "Prometheus"
},
"disableTextWrap": false,
"dsType": "influxdb",
"editorMode": "code",
"expr": "(\r\n sort_desc(\r\n topk(\r\n 5,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_seconds_total{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n unless (\r\n topk(\r\n 20,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_time_milliseconds{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n)\r\n* on (queryid)\r\ngroup_left(instance, query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n",
"format": "table",
"fullMetaSearch": false,
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"includeNullMetadata": true,
"instant": false,
"interval": "$__interval_ms",
"intervalFactor": 1,
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"useBackend": false
}
],
"title": "New Slow Queries for All Databases",
"type": "table"
}
],
"preload": false,
"schemaVersion": 41,
"tags": [],
"templating": {
"list": [
{
"current": {
"text": "rc1b-flohldmalt9k1tth.mdb.yandexcloud.net:6432/db1",
"value": "rc1b-flohldmalt9k1tth.mdb.yandexcloud.net:6432/db1"
},
"definition": "label_values({job=\"integrations/postgres-exporter\"},instance)",
"description": "",
"includeAll": false,
"name": "Instance",
"options": [],
"query": {
"qryType": 1,
"query": "label_values({job=\"integrations/postgres-exporter\"},instance)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"type": "query"
},
{
"current": {
"text": "All",
"value": "$__all"
},
"definition": "label_values(pg_stat_database_tup_fetched{instance=\"$Instance\"},datname)",
"includeAll": true,
"multi": true,
"name": "Database",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(pg_stat_database_tup_fetched{instance=\"$Instance\"},datname)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "/^(?!template*|postgres).*$/",
"type": "query"
}
]
},
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "PostgreSQL Exporter",
"uid": "77ddcb0e-278f-4e0b-94e5-8b03b208d94d",
"version": 3
}