|
- {
- "id": 0,
- "group_id": 0,
- "name": "postgresql by categraf",
- "ident": "",
- "tags": "categraf",
- "create_at": 0,
- "create_by": "",
- "update_at": 0,
- "update_by": "",
- "configs": {
- "links": [
- {
- "targetBlank": true,
- "title": "文档",
- "url": "https://github.com/ccfos/nightingale/tree/main/integrations/postgresql/markdown/"
- }
- ],
- "panels": [
- {
- "collapsed": true,
- "id": "7f38f76f-5e62-4660-a104-a7f1e6e73aeb",
- "layout": {
- "h": 1,
- "i": "7f38f76f-5e62-4660-a104-a7f1e6e73aeb",
- "isResizable": false,
- "w": 24,
- "x": 0,
- "y": 0
- },
- "name": "pg_stat_database",
- "panels": [],
- "type": "row"
- },
- {
- "custom": {
- "calc": "lastNotNull",
- "colSpan": 1,
- "colorMode": "value",
- "textMode": "valueAndName",
- "textSize": {
- "title": 32,
- "value": 46
- },
- "valueField": "Value"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "id": "65571b64-d249-40f1-8c57-ef826118c7a9",
- "layout": {
- "h": 4,
- "i": "65571b64-d249-40f1-8c57-ef826118c7a9",
- "isResizable": true,
- "w": 6,
- "x": 0,
- "y": 1
- },
- "name": "连接数",
- "options": {
- "standardOptions": {},
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- }
- },
- "targets": [
- {
- "expr": "postgresql_numbackends{server=\"$server\",db=\"$db\"}",
- "legend": "{{db}}",
- "refId": "A"
- }
- ],
- "type": "stat",
- "version": "2.0.0"
- },
- {
- "custom": {
- "calc": "lastNotNull",
- "colSpan": 1,
- "colorMode": "value",
- "textMode": "valueAndName",
- "textSize": {
- "title": 32,
- "value": 46
- },
- "valueField": "Value"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "命中率低于99%,就需要适当调大shared buffer",
- "id": "bdf5299c-b621-4d98-bcf8-fa2ebd12b7d4",
- "layout": {
- "h": 4,
- "i": "0fb92b82-63c4-4edd-a452-fb51150757ab",
- "isResizable": true,
- "w": 6,
- "x": 6,
- "y": 1
- },
- "name": "缓存命中率",
- "options": {
- "standardOptions": {
- "util": "percentUnit"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- }
- },
- "targets": [
- {
- "expr": "postgresql_blks_hit{server=\"$server\",db=\"$db\"}/(postgresql_blks_hit{server=\"$server\",db=\"$db\"}+postgresql_blks_read{server=\"$server\",db=\"$db\"})",
- "legend": "{{db}}",
- "refId": "A"
- }
- ],
- "type": "stat",
- "version": "2.0.0"
- },
- {
- "custom": {
- "calc": "lastNotNull",
- "colSpan": 1,
- "colorMode": "value",
- "textMode": "valueAndName",
- "textSize": {
- "title": 32,
- "value": 46
- },
- "valueField": "Value"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "死锁的数量,如果这个值很大说明业务逻辑有问题",
- "id": "2a559648-ad51-40d1-a6ff-f641467b57ea",
- "layout": {
- "h": 4,
- "i": "d78ae395-1d53-481a-9566-9f4913616330",
- "isResizable": true,
- "w": 6,
- "x": 12,
- "y": 1
- },
- "name": "死锁数",
- "options": {
- "standardOptions": {
- "util": "none"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- }
- },
- "targets": [
- {
- "expr": "postgresql_deadlocks{server=\"$server\",db=\"$db\"}",
- "legend": "{{db}}",
- "refId": "A"
- }
- ],
- "type": "stat",
- "version": "2.0.0"
- },
- {
- "custom": {
- "calc": "lastNotNull",
- "colSpan": 1,
- "colorMode": "value",
- "textMode": "valueAndName",
- "textSize": {
- "title": 32,
- "value": 46
- },
- "valueField": "Value"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "与恢复冲突取消的查询次数,只会在备机上发生",
- "id": "87a74ec2-c6d2-49e8-a1ea-4dbf1252a33d",
- "layout": {
- "h": 4,
- "i": "a666823e-455f-459e-bbfe-169341b77ddc",
- "isResizable": true,
- "w": 6,
- "x": 18,
- "y": 1
- },
- "name": "冲突数",
- "options": {
- "standardOptions": {
- "util": "none"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- }
- },
- "targets": [
- {
- "expr": "postgresql_conflicts{server=\"$server\",db=\"$db\"}",
- "legend": "{{db}}",
- "refId": "A"
- }
- ],
- "type": "stat",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "rollback 过多,则需要检查业务逻辑,表面业务逻辑存在问题",
- "id": "3dea2872-5904-4abf-b0f8-64afe82b617a",
- "layout": {
- "h": 4,
- "i": "443aee8c-d1b8-485b-b74f-13fa58b6e7ae",
- "isResizable": true,
- "w": 12,
- "x": 0,
- "y": 5
- },
- "name": "事务统计",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {},
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_xact_commit{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "commit",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_xact_rollback{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "rollback",
- "refId": "B"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "returned ,代表执行查询遍历行数\nfetched,代表返回给客户端的行数\nreturned 远大于 fetched,代表查询效率低,存在全表扫描,应增加索引进行优化",
- "id": "dec2c25d-ae70-4e47-bc4f-6dbaa9e72683",
- "layout": {
- "h": 4,
- "i": "8b85bc95-091a-4868-9bec-b495609d7a04",
- "isResizable": true,
- "w": 12,
- "x": 12,
- "y": 5
- },
- "name": "数据查询统计",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {},
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_tup_returned{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "returned",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_tup_fetched{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "fetched",
- "refId": "B"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "",
- "id": "048d2652-40f1-42ab-a435-7e02d51c98c4",
- "layout": {
- "h": 4,
- "i": "e08d94bb-1a72-4104-8ba0-11ab7317a192",
- "isResizable": true,
- "w": 12,
- "x": 0,
- "y": 9
- },
- "name": "数据更新统计",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {},
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_tup_inserted{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "inserted",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_tup_updated{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "updated",
- "refId": "B"
- },
- {
- "expr": "increase(postgresql_tup_deleted{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "deleted",
- "refId": "C"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "temp_files较高说明存在很多排序,hash,或者聚合这种操作,可以增大work_mem减少临时文件的产生,并且同时这些操作的性能也会有较大的提升",
- "id": "c89d1e4b-d8ad-402d-bee4-f6d362b4634a",
- "layout": {
- "h": 4,
- "i": "971c5838-7408-4ec7-ae5e-33dcd0f20210",
- "isResizable": true,
- "w": 12,
- "x": 12,
- "y": 9
- },
- "name": "生成临时文件统计",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {},
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_temp_files{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "temp_files",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_temp_bytes{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "temp_bytes",
- "refId": "B"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "数据库中花费在读取文件的时间,这个值很高说明内存较小,需要频繁从磁盘读入数据文件\n数据库中花费在写数据文件的时间,pg中脏页一般写入page cache,如果这个值较高,则说明cache较小,操作系统的cache需要更积极的写入",
- "id": "7ae2c26a-cc2b-435d-9a16-52722c37bedf",
- "layout": {
- "h": 4,
- "i": "71e28edd-8961-4a7a-be78-3a9a526c89bb",
- "isResizable": true,
- "w": 24,
- "x": 0,
- "y": 13
- },
- "name": "数据库读写时间统计",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {
- "util": "milliseconds"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_blk_read_time{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "blk_read_time",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_blk_write_time{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "blk_write_time",
- "refId": "B"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "collapsed": true,
- "id": "72575aba-dbf5-4a05-8bd6-64170bff617e",
- "layout": {
- "h": 1,
- "i": "72575aba-dbf5-4a05-8bd6-64170bff617e",
- "isResizable": false,
- "w": 24,
- "x": 0,
- "y": 17
- },
- "name": "pg_stat_bgwriter",
- "type": "row"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "postgresql_checkpoints_timed:指超过checkpoint_timeout的时间后触发的检查点次数\npostgresql_checkpoints_req:手动触发checkpoint或者因为WAL文件数量达到max_wal_size时也会增加,如果这个值大于postgresql_checkpoints_timed说明checkpoint_timeout设置的不合理",
- "id": "600a9687-0a1e-4531-b9bc-ccf8589566a2",
- "layout": {
- "h": 5,
- "i": "c3d3ccee-719f-4280-8921-367ea5343849",
- "isResizable": true,
- "w": 12,
- "x": 0,
- "y": 18
- },
- "name": "checkpoint分布",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {
- "util": "none"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_checkpoints_timed{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "postgresql_checkpoints_timed",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_checkpoints_req{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "postgresql_checkpoints_req",
- "refId": "B"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "checkpoint_write_time: 从shared buffer 中write到page cache花费的时间\ncheckpoint_sync_time : checkpoint调用fsync将脏数据刷到磁盘花费的时间,如果这个值很长,容易造成IO抖动,需要增加checkpoint_timeout或者checkpoint_completion_target",
- "id": "561012f8-481a-482a-8504-4bdd8c62e8a6",
- "layout": {
- "h": 5,
- "i": "178d8220-3c22-4ea3-909d-71c73fbb3a78",
- "isResizable": true,
- "w": 12,
- "x": 12,
- "y": 18
- },
- "name": "checkpoint 写文件时间分布",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {
- "util": "milliseconds"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_checkpoint_write_time{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "checkpoint_write_time",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_checkpoint_sync_time{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "checkpoint_sync_time",
- "refId": "B"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- },
- {
- "custom": {
- "drawStyle": "lines",
- "fillOpacity": 0.3,
- "gradientMode": "opacity",
- "lineInterpolation": "smooth",
- "lineWidth": 2,
- "stack": "off"
- },
- "datasourceCate": "prometheus",
- "datasourceValue": "${datasource}",
- "description": "buffers_checkpoint: checkpoint写数据块数量\nbuffers_clean:bgwriter写入数据块的数量\nbuffers_backend:通过backend写入的块数量, 此值过大,代表shared buffer没有维护好,后端进程不得不自己去进行刷盘的动作\nbuffers_backend_fsync: backend需要fsync的次数\n",
- "id": "af9e2a7f-ce09-4de2-8625-e779c770d46d",
- "layout": {
- "h": 5,
- "i": "23b6fc64-1a19-422e-b28e-453570af339c",
- "isResizable": true,
- "w": 24,
- "x": 0,
- "y": 23
- },
- "name": "数据块写入分布",
- "options": {
- "legend": {
- "displayMode": "hidden"
- },
- "standardOptions": {
- "util": "none"
- },
- "thresholds": {
- "steps": [
- {
- "color": "#634CD9",
- "type": "base",
- "value": null
- }
- ]
- },
- "tooltip": {
- "mode": "all",
- "sort": "none"
- }
- },
- "targets": [
- {
- "expr": "increase(postgresql_buffers_checkpoint{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "buffers_checkpoint",
- "refId": "A"
- },
- {
- "expr": "increase(postgresql_buffers_clean{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "buffers_clean",
- "refId": "B"
- },
- {
- "expr": "increase(postgresql_buffers_backend{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "buffers_backend",
- "refId": "C"
- },
- {
- "expr": "increase(postgresql_buffers_backend_fsync{server=\"$server\",db=\"$db\"}[5m])",
- "legend": "buffers_backend_fsync",
- "refId": "D"
- }
- ],
- "type": "timeseries",
- "version": "2.0.0"
- }
- ],
- "var": [
- {
- "definition": "prometheus",
- "name": "datasource",
- "type": "datasource"
- },
- {
- "datasource": {
- "cate": "prometheus",
- "value": "${datasource}"
- },
- "definition": "label_values(postgresql_datid,server)",
- "name": "server",
- "type": "query"
- },
- {
- "datasource": {
- "cate": "prometheus",
- "value": "${datasource}"
- },
- "definition": "label_values(postgresql_datid{server=\"$server\"},db)",
- "name": "db",
- "type": "query"
- }
- ],
- "version": "3.0.0"
- },
- "public": 0,
- "public_cate": 0,
- "bgids": null,
- "built_in": 0,
- "hide": 0,
- "uuid": 1717556328244926000
- }
|