observability.svc.plus/files/grafana/pgsql/pgsql-pitr.json
2026-02-01 20:53:55 +08:00

1068 lines
74 KiB
JSON

{
"annotations":{"list":[{"builtIn":1,"datasource":{"type":"datasource","uid":"grafana"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},
"author":"Ruohang Feng (rh@vonng.com)",
"description":"PostgreSQL PITR Auxiliary Dashboard",
"editable":true,
"fiscalYearStartMonth":0,
"graphTooltip":0,
"id":null,
"license":"https://pigsty.io/docs/about/license/",
"links":[
{ "asDropdown":false,"icon":"question" ,"includeVars":false,"keepTime":false,"tags":[] ,"targetBlank":true ,"title":"PITR Docs","tooltip":"Restore Tutorial","type":"link" ,"url":"https://pigsty.io/docs/pgsql/backup/restore" },
{ "asDropdown":true ,"icon":"external link","includeVars":true ,"keepTime":true ,"tags":["Pigsty","PGSQL","Overview"],"targetBlank":false,"title":"Overview" ,"tooltip":"" ,"type":"dashboards","url":"" },
{ "asDropdown":true ,"icon":"external link","includeVars":true ,"keepTime":true ,"tags":["Pigsty","PGSQL","Cluster"] ,"targetBlank":false,"title":"Cluster" ,"tooltip":"" ,"type":"dashboards","url":"" },
{ "asDropdown":true ,"icon":"external link","includeVars":true ,"keepTime":true ,"tags":["Pigsty","PGSQL","Instance"],"targetBlank":false,"title":"Instance" ,"tooltip":"" ,"type":"dashboards","url":"" },
{ "asDropdown":true ,"icon":"external link","includeVars":true ,"keepTime":true ,"tags":["Pigsty","PGSQL","Database"],"targetBlank":false,"title":"Database" ,"tooltip":"" ,"type":"dashboards","url":"" }
],
"panels":[
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":212,"panels":[],"title":"Instance & Stanza","type":"row"},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"All instances among pgsql cluster ${cls}\n\nArchive: archive_mode of this instance\n\nClusterID: systemd id, may change if PITR from another cluster.",
"fieldConfig":{
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":false},"mappings":[],"max":1.2,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"#e3e3e3e0","value":0}]}},
"overrides":[
{"matcher":{"id":"byName","options":"Instance"},"properties":[{"id":"links","value":[{"title":"PGSQL Instance ${__data.fields.Instance}","url":"/d/pgsql-instance?var-ins=${__data.fields.Instance}&${__url_time_range}"}]},{"id":"custom.width"}]},
{"matcher":{"id":"byName","options":"IP"},"properties":[{"id":"custom.width","value":110},{"id":"links","value":[{"title":"Node Instance : ${__data.fields.IP}","url":"/d/node-instance?var-id=${__data.fields.IP}&${__url_time_range}"}]}]},
{"matcher":{"id":"byName","options":"Role"},"properties":[{"id":"custom.width","value":80},{"id":"mappings","value":[{"options":{"0":{"color":"#3e668f","index":0,"text":"primary"},"1":{"color":"#346f36cc","index":1,"text":"replica"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"links","value":[]}]},
{"matcher":{"id":"byName","options":"Up"},"properties":[{"id":"custom.width","value":80},{"id":"mappings","value":[{"options":{"0":{"color":"#cc4637d9","index":0,"text":"Dead"},"1":{"color":"#346f36cc","index":1,"text":"Alive"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]},
{
"matcher":{"id":"byName","options":"Archive"},
"properties":[{"id":"mappings","value":[{"options":{"-1":{"color":"#b783af","index":0,"text":"Other"},"-2":{"color":"#d44a3a","index":3,"text":"Always"},"0":{"color":"#fcdb72","index":1,"text":"Off"},"1":{"color":"#346f36cc","index":2,"text":"On"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":100}]
},
{"matcher":{"id":"byName","options":"ClusterID"},"properties":[{"id":"custom.width","value":180}]},{"matcher":{"id":"byName","options":"LSN"},"properties":[{"id":"unit","value":"hex0x"},{"id":"custom.width","value":105}]}
]
},
"gridPos":{"h":5,"w":14,"x":0,"y":1},
"id":211,
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":false,"displayName":"Instance"}]},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins,ip) (up{job=\"pgsql\", cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_setting_archive_mode{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins,ip) (pg_in_recovery{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"D" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins,ip, cluster_id) (pg_meta_info{cls=\"$cls\"})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"C" }
],
"title":"Instance",
"transformations":[
{"id":"seriesToColumns","options":{"byField":"ins"}},
{
"id":"organize",
"options":{
"excludeByName":{
"Time":true,
"Time 1":true,
"Time 10":true,
"Time 2":true,
"Time 3":true,
"Time 4":true,
"Time 6":true,
"Time 8":true,
"Time 9":true,
"Value #A":false,
"Value #B":false,
"Value #C":true,
"Value #H":false,
"__name__":true,
"__name__ 1":true,
"__name__ 2":true,
"__name__ 3":true,
"__name__ 5":true,
"__name__ 7":true,
"cls":true,
"cls 1":true,
"cls 2":true,
"cls 3":true,
"cls 4":true,
"cls 5":true,
"cls 6":true,
"cls 7":true,
"instance":false,
"instance 1":true,
"instance 2":false,
"instance 3":true,
"instance 4":true,
"instance 5":true,
"instance 6":true,
"ip 2":true,
"ip 3":true,
"ip 4":true,
"ip 5":true,
"ip 6":true,
"ip 7":true,
"job":true,
"job 1":true,
"job 2":true,
"job 3":true,
"job 4":true,
"job 5":true,
"job 6":true,
"job 7":true
},
"includeByName":{},
"indexByName":{"Time 1":8,"Time 2":9,"Time 3":10,"Time 4":11,"Time 5":14,"Value #A":0,"Value #B":4,"Value #C":7,"Value #D":1,"Value #E":6,"cluster_id":5,"ins":2,"ip 1":3,"ip 2":12,"ip 3":13,"ip 4":15},
"renameByName":{"Time 4":"","Value #A":"Up","Value #B":"Archive","Value #C":"","Value #D":"Role","Value #E":"LSN","Value #F":"RT","Value #G":"LB Conn","Value #H":"LB","Value #I":"QPS","Value #J":"LB Clients","Value #K":"Lag","cls 1":"","cls 2":"","cluster_id":"ClusterID","ins":"Instance","instance":"HAProxy","instance 2":"","ip":"IP","ip 1":"IP","ip 3":""}
}
}
],
"type":"table"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"Backup repository & stanza\n\nStanza: Cluster level backup repo, click will list available backups in this stanza\n\nStatus:\n\n0 - ok,\n1 - missing stanza path,\n2 - no valid backups,\n3 - missing stanza data,\n4 - different across repos,\n5 - database mismatch across repos,\n6 - requested backup not found,\n99 - other.\n\nLock:\n\n0 - no active operation with stanza,\n1 - one of the commands is running for stanza: backup, expire or stanza-*.",
"fieldConfig":{
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"filterable":false,"footer":{"reducers":[]},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
"overrides":[
{
"matcher":{"id":"byName","options":"Status"},
"properties":[
{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0},{"color":"red","value":0.5}]}},
{
"id":"mappings",
"value":[{"options":{"0":{"index":0,"text":"ok"},"1":{"index":1,"text":"missing stanza path"},"2":{"index":2,"text":"no valid backups"},"3":{"index":3,"text":"missing stanza data"},"4":{"index":4,"text":"different across repos"},"5":{"index":5,"text":"database mismatch across repos"},"6":{"index":6,"text":"requested backup not found"},"99":{"index":7,"text":"other"}},"type":"value"}]
},
{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":120}
]
},
{"matcher":{"id":"byName","options":"Repo"},"properties":[{"id":"custom.width","value":60}]},{"matcher":{"id":"byName","options":"Cipher"},"properties":[{"id":"custom.width","value":120}]},
{"matcher":{"id":"byName","options":"Stanza"},"properties":[{"id":"custom.minWidth","value":120},{"id":"links","value":[{"title":"PGSQL PITR : ${cls} ${__data.fields.Stanza}","url":"/d/pgsql-pitr?var-cls=$cls&var-stanza=${__data.fields.Stanza}&${__url_time_range}"}]}]},
{"matcher":{"id":"byName","options":"Lock"},"properties":[{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"Idle"},"1":{"color":"#f79f64","index":1,"text":"backup/expire"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":110}]}
]
},
"gridPos":{"h":5,"w":10,"x":14,"y":1},
"id":197,
"options":{"cellHeight":"sm","frameIndex":1,"showHeader":true,"sortBy":[{"desc":false,"displayName":"Stanza"}]},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pgbackrest_repo_status{ins=\"$primary\"}" ,"format":"table", "instant":true,"interval":"","legendFormat":"","refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pgbackrest_stanza_lock_status{ins=\"$primary\"}","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" }
],
"title":"Stanza",
"transformations":[
{ "id":"joinByField" ,"options":{"byField":"stanza","mode":"outer"} },
{ "id":"filterFieldsByName","options":{"include":{"names":["stanza","cipher","repo_key","Value #B","Value #A"]}} },
{ "id":"organize" ,"options":{"excludeByName":{"stanza 2":false},"includeByName":{},"indexByName":{"Value":3,"cipher":2,"repo_key":0,"stanza":1},"renameByName":{"Value":"Status","Value #A":"Status","Value #B":"Lock","cipher":"Cipher","repo_key":"Repo","stanza":"Stanza"}} }
],
"type":"table"
},
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":6},"id":195,"panels":[],"title":"Backup","type":"row"},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"Backup detail info for selected stanzas, repos, backup types, block incremental statuses and backup names.",
"fieldConfig":{
"defaults":{"custom":{"align":"center","cellOptions":{"type":"auto"},"filterable":false,"footer":{"reducers":[]},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"text","value":0}]}},
"overrides":[
{"matcher":{"id":"byName","options":"Stanza"},"properties":[{"id":"custom.width","value":250}]},{"matcher":{"id":"byName","options":"Repo key"},"properties":[{"id":"custom.width","value":95}]},
{
"matcher":{"id":"byName","options":"Type"},
"properties":[{"id":"custom.width","value":80},{"id":"custom.filterable","value":true},{"id":"custom.align","value":"center"},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"mappings","value":[{"options":{"diff":{"color":"#f9d46c","index":1,"text":"DIFF"},"full":{"color":"#2d436f","index":0,"text":"FULL"},"incr":{"color":"#0b5b52","index":2,"text":"INCR"}},"type":"value"}]}]
},
{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.minWidth","value":280},{"id":"custom.align","value":"left"}]},{"matcher":{"id":"byName","options":"Database ID"},"properties":[{"id":"custom.width","value":110}]},{"matcher":{"id":"byName","options":"WAL Start"},"properties":[{"id":"custom.width","value":225}]},
{"matcher":{"id":"byName","options":"WAL Stop"},"properties":[{"id":"custom.width","value":225}]},{"matcher":{"id":"byName","options":"Prior"},"properties":[{"id":"custom.width","value":160},{"id":"custom.align","value":"left"}]},{"matcher":{"id":"byRegexp","options":"/LSN.*/"},"properties":[{"id":"custom.width","value":110},{"id":"custom.align","value":"center"}]},
{"matcher":{"id":"byRegexp","options":"/Time.*/"},"properties":[{"id":"unit","value":"string"},{"id":"custom.width","value":160},{"id":"custom.align","value":"center"}]},{"matcher":{"id":"byName","options":"BlockIncr"},"properties":[{"id":"custom.width","value":80},{"id":"mappings","value":[{"options":{"y":{"color":"green","index":0,"text":"Yes"}},"type":"value"}]}]},
{"matcher":{"id":"byName","options":"Duration"},"properties":[{"id":"custom.width","value":80},{"id":"unit","value":"s"}]},
{
"matcher":{"id":"byRegexp","options":"/.*Size.*/"},
"properties":[
{ "id":"unit" ,"value":"decbytes" },
{ "id":"custom.width" ,"value":100 },
{ "id":"thresholds" ,"value":{"mode":"absolute","steps":[{"color":"#3e668f","value":0},{"color":"#346f36cc","value":1000000000},{"color":"#fcdb72","value":10000000000},{"color":"#ed8128e3","value":100000000000},{"color":"#d44a3a","value":100000000000},{"color":"#b783af","value":1000000000000}]} },
{ "id":"custom.cellOptions","value":{"type":"color-text"} }
]
},
{"matcher":{"id":"byName","options":"PG Ver"},"properties":[{"id":"custom.width","value":66}]},{"matcher":{"id":"byName","options":"PB Ver"},"properties":[{"id":"custom.width","value":66}]},
{"matcher":{"id":"byName","options":"Status"},"properties":[{"id":"custom.width","value":66},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"OK"},"1":{"color":"#d44a3a","index":1,"text":"Error"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]},
{"matcher":{"id":"byName","options":"BlockIncr"},"properties":[{"id":"mappings","value":[{"options":{"n":{"color":"#d44a3a","index":1,"text":"No"},"y":{"color":"#346f36cc","index":0,"text":"Yes"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]}
]
},
"gridPos":{"h":7,"w":24,"x":0,"y":7},
"id":200,
"links":[{"title":"PGCAT Backup : $primary","url":"/d/pgcat-instance?var-dsn=${primary}.postgres&${__url_time_range}&viewPanel=158"}],
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":true,"displayName":"Time Start"}]},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbackrest_backup_info{ins=\"$primary\",stanza=~\"$stanza\"}" ,"format":"table", "instant":true,"interval":"","legendFormat":"","refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"max by (backup_name,start_time,stop_time) (pgbackrest_backup_duration_seconds{ins=\"$primary\",stanza=~\"$stanza\"})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"max by (backup_name) (pgbackrest_backup_error_status{ins=\"$primary\",stanza=~\"$stanza\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"C" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"max by (backup_name) (pgbackrest_backup_size_bytes{ins=\"$primary\",stanza=~\"$stanza\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"D" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"max by (backup_name) (pgbackrest_backup_delta_bytes{ins=\"$primary\",stanza=~\"$stanza\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"E" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"max by (backup_name) (pgbackrest_backup_repo_delta_bytes{ins=\"$primary\",stanza=~\"$stanza\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"F" }
],
"title":"Backup of Stanza ${stanza}",
"transformations":[
{"id":"joinByField","options":{"byField":"backup_name","mode":"outer"}},
{
"id":"organize",
"options":{
"excludeByName":{
"Time":true,
"Time 1":true,
"Time 2":true,
"Time 3":true,
"Time 4":true,
"Time 5":true,
"Time 6":true,
"Value":true,
"Value #A":true,
"__name__":true,
"__name__ 1":true,
"__name__ 2":true,
"__name__ 3":true,
"backup_type 2":true,
"backup_type 3":true,
"block_incr 2":true,
"block_incr 3":true,
"cls":true,
"cls 1":true,
"cls 2":true,
"cls 3":true,
"database_id":true,
"database_id 1":true,
"database_id 2":true,
"database_id 3":true,
"ins":true,
"ins 1":true,
"ins 2":true,
"ins 3":true,
"instance":true,
"instance 1":true,
"instance 2":true,
"instance 3":true,
"ip":true,
"ip 1":true,
"ip 2":true,
"ip 3":true,
"job":true,
"job 1":true,
"job 2":true,
"job 3":true,
"prj 1":true,
"prj 2":true,
"prometheus 1":true,
"prometheus 2":true,
"repo_key":true,
"repo_key 1":false,
"repo_key 2":true,
"repo_key 3":true,
"service 1":true,
"service 2":true,
"stanza":true,
"stanza 2":true,
"stanza 3":true
},
"includeByName":{},
"indexByName":{
"Time 1":16,
"Time 2":21,
"Time 3":29,
"Time 4":30,
"Time 5":31,
"Time 6":32,
"Value #A":17,
"Value #B":3,
"Value #C":6,
"Value #D":4,
"Value #E":13,
"Value #F":5,
"__name__":22,
"backrest_ver":15,
"backup_name":1,
"backup_type":0,
"block_incr":23,
"cls":24,
"database_id":18,
"ins":25,
"instance":26,
"ip":27,
"job":28,
"lsn_start":9,
"lsn_stop":10,
"pg_version":14,
"prior":2,
"repo_key":19,
"stanza":20,
"start_time":7,
"stop_time":8,
"wal_start":11,
"wal_stop":12
},
"renameByName":{
"Value #A":"Error",
"Value #B":"Duration",
"Value #C":"Status",
"Value #D":"Size",
"Value #E":"Scan Size",
"Value #F":"\u0394Size",
"__name__ 1":"",
"backrest_ver":"PB Ver",
"backup_name":"Name",
"backup_type":"Type",
"backup_type 1":"Type",
"block_incr":"BlockIncr",
"block_incr 1":"BlockIncr",
"database_id":"Database ID",
"database_id 1":"Database ID",
"lsn_start":"LSN Start",
"lsn_stop":"LSN Stop",
"pg_version":"PG Ver",
"prior":"Prior",
"repo_key":"Repo key",
"repo_key 1":"Repo key",
"stanza":"Stanza",
"stanza 1":"Stanza",
"start_time":"Time Start",
"stop_time":"Time Stop",
"wal_start":"WAL Start",
"wal_stop":"WAL Stop"
}
}
}
],
"type":"table"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"",
"fieldConfig":{
"defaults":{
"color":{"mode":"thresholds"},
"links":[],
"mappings":[{"options":{"-1":{"color":"#b783af","index":0,"text":"Other"},"0":{"color":"#d44a3a","index":3,"text":"Off"},"1":{"color":"#346f36cc","index":2,"text":"On"},"2":{"color":"#fcdb72","index":1,"text":"Always"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"#8b8b8bd9","index":4,"text":"N/A"}},"type":"special"}],
"max":1,
"min":0,
"thresholds":{"mode":"absolute","steps":[{"color":"#cc4637d9","value":0},{"color":"#346f36cc","value":1}]},
"unit":"none"
},
"overrides":[]
},
"gridPos":{"h":6,"w":3,"x":0,"y":14},
"id":209,
"options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["last"],"fields":"","values":false},"showPercentChange":false,"text":{"valueSize":16},"textMode":"auto","wideLayout":true},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max(pg_setting_archive_mode{cls=\"$cls\"})","interval":"","legendFormat":"WAL Archive","range":true,"refId":"A"}],
"type":"stat"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"fieldConfig":{
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":false},"mappings":[{"options":{"match":"null+nan","result":{"color":"transparent","index":1}},"type":"special"}],"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]}},
"overrides":[
{"matcher":{"id":"byName","options":"Instance"},"properties":[{"id":"links","value":[{"title":"PGSQL Instance: ${__data.fields.Instance}","url":"/d/pgsql-instance?var-ins=${__data.fields.Instance}&${__url_time_range}"}]},{"id":"custom.minWidth","value":120}]},
{"matcher":{"id":"byName","options":"Cluster"},"properties":[{"id":"links","value":[{"title":"PGSQL Cluster: ${__data.fields.Cluster}","url":"/d/pgsql-cluster?var-cls=${__data.fields.Cluster}&${__url_time_range}"}]},{"id":"custom.minWidth","value":120}]},
{"matcher":{"id":"byName","options":"Shard"},"properties":[{"id":"links","value":[{"title":"PGSQL Shard : ${__data.fields.Shard}","url":"/d/pgsql-shard?var-shard=${__data.fields.Shard}&${__url_time_range}"}]},{"id":"custom.width","value":100}]},
{
"matcher":{"id":"byName","options":"Patroni Status"},
"properties":[
{ "id":"custom.width" ,"value":120 },
{ "id":"mappings" ,"value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"Follower"},"1":{"color":"#3e668f","index":1,"text":"Leader"},"2":{"color":"#f79f64","index":2,"text":"Standby Leader"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"#808080","index":3,"text":"Unknown"}},"type":"special"}] },
{ "id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"} }
]
},
{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"PG Ver"},"properties":[{"id":"custom.width","value":80}]},
{
"matcher":{"id":"byName","options":"Paused"},
"properties":[{"id":"custom.width","value":80},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"Running"},"1":{"color":"#f79f64","index":1,"text":"Paused"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}}]
},{
"matcher":{"id":"byName","options":"Lock"},
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"Unlocked"},"1":{"color":"#b783af","index":1,"text":"Locked"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]
},{
"matcher":{"id":"byName","options":"Restart"},
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"No Need"},"1":{"color":"#f79f64","index":1,"text":"Pending"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]
},{
"matcher":{"id":"byName","options":"Failsafe"},
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"Inactive"},"1":{"color":"#cc4637d9","index":1,"text":"Active"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]
},{
"matcher":{"id":"byName","options":"WAL"},
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"Proceed"},"1":{"color":"#f79f64","index":1,"text":"Paused"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]
},{
"matcher":{"id":"byName","options":"Postgres"},
"properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"mappings","value":[{"options":{"0":{"color":"#cc4637d9","index":0,"text":"Down"},"1":{"color":"#346f36cc","index":1,"text":"Alive"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"transparent","index":2}},"type":"special"}]}]
},
{"matcher":{"id":"byName","options":"PG Uptime "},"properties":[{"id":"custom.width","value":100},{"id":"unit","value":"s"},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#cc4637d9","value":0},{"color":"#f79f64","value":300},{"color":"#fcdb72","value":3600},{"color":"#346f36cc","value":86400}]}}]},
{
"matcher":{"id":"byName","options":"DCS Seen"},
"properties":[{"id":"custom.width","value":100},{"id":"unit","value":"s"},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0},{"color":"#f79f64","value":20},{"color":"#cc4637d9","value":30},{"color":"#b783af","value":60},{"color":"text","value":300}]}},{"id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}}]
},
{"matcher":{"id":"byName","options":"Patroni"},"properties":[{"id":"custom.width","value":90},{"id":"mappings","value":[{"options":{"0":{"color":"#cc4637d9","index":0,"text":"Down"},"1":{"color":"#346f36cc","index":1,"text":"Alive"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]},
{"matcher":{"id":"byName","options":"PG Status"},"properties":[{"id":"mappings","value":[{"options":{"0":{"color":"#3e668f","index":0,"text":"Leading"},"1":{"color":"#346f36cc","index":1,"text":"Recovery"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":100}]},
{"matcher":{"id":"byName","options":"Recv TLI"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"Timeline"},"properties":[{"id":"custom.width","value":80}]},{"matcher":{"id":"byName","options":"LSN"},"properties":[{"id":"custom.width","value":120},{"id":"unit","value":"hex0x"}]},
{"matcher":{"id":"byName","options":"XID"},"properties":[{"id":"custom.width","value":100}]},
{"matcher":{"id":"byName","options":"Descendant"},"properties":[{"id":"custom.width","value":100},{"id":"mappings","value":[{"options":{"from":1,"result":{"color":"#346f36cc","index":0},"to":99999},"type":"range"},{"options":{"match":"null+nan","result":{"color":"transparent","index":1}},"type":"special"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]},
{
"matcher":{"id":"byName","options":"Replication"},
"properties":[
{
"id":"mappings",
"value":[
{ "options":{"-1":{"color":"#A352CC","index":0,"text":"unknown"},"0":{"color":"#346f36cc","index":1,"text":"streaming"},"1":{"color":"#e02f44bf","index":2,"text":"startup"},"2":{"color":"#f2cc0cbf","index":3,"text":"catchup"},"3":{"color":"#3275d9bf","index":4,"text":"backup"},"4":{"color":"#ff780abf","index":5,"text":"stopping"}},"type":"value" },
{ "options":{"match":"null+nan","result":{"color":"transparent","index":6}} ,"type":"special" }
]
},
{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":100}
]
},
{"matcher":{"id":"byName","options":"TLI Sync"},"properties":[{"id":"custom.width","value":80},{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":0,"text":"True"},"1":{"color":"#cc4637d9","index":1,"text":"False"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]}
]
},
"gridPos":{"h":6,"w":21,"x":3,"y":14},
"id":152,
"links":[{"title":"PGSQL Patroni : ${cls}","url":"/d/pgsql-patroni?var-cls=${cls}&${__url_time_range}"}],
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":false,"displayName":"Instance"}]},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (patroni_primary{cls=\"$cls\"}) + \nmax by (ins) (patroni_standby_leader{cls=\"$cls\"})","format":"table", "instant":true,"legendFormat":"__auto","range":false,"refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_timeline_id{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"B" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_xact_xmax{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"C" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (patroni_is_paused{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"D" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_lsn{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"E" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"count by (ins) (pg_repl_lsn{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"F" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins,state) (pg_recv_flush_tli{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"G" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (patroni_xlog_paused{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"H" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (patroni_postgres_running{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"I" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_timeline_id{cls=\"$cls\"} < bool on(cls) group_left() max by (cls)(pg_timeline_id{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"J" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (time() - patroni_postmaster_start_time{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"K" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (patroni_up{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"L" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins,ip) (pg_up{cls=\"$cls\", job=\"pgsql\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"M" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins) (pg_in_recovery{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"legendFormat":"__auto","range":false,"refId":"N" }
],
"title":"Postgres & Patroni PITR Status",
"transformations":[
{"id":"joinByField","options":{"byField":"ins","mode":"outer"}},
{
"id":"organize",
"options":{
"excludeByName":{
"Time":true,
"Time 1":true,
"Time 10":true,
"Time 11":true,
"Time 12":true,
"Time 13":true,
"Time 14":true,
"Time 2":true,
"Time 3":true,
"Time 4":true,
"Time 5":true,
"Time 6":true,
"Time 7":true,
"Time 8":true,
"Time 9":true,
"Value #B":false,
"Value #C":false,
"Value #E":false,
"Value #F":false,
"Value #G":false,
"Value #H":true,
"Value #I":true,
"Value #J":false,
"__name__ 1":false,
"cls":true,
"instance":true,
"ip":true,
"ip 1":true,
"ip 2":true,
"job":true,
"scope":true
},
"includeByName":{},
"indexByName":{
"Time 1":15,
"Time 10":24,
"Time 11":25,
"Time 12":26,
"Time 13":32,
"Time 14":33,
"Time 2":16,
"Time 3":17,
"Time 4":18,
"Time 5":19,
"Time 6":20,
"Time 7":21,
"Time 8":22,
"Time 9":23,
"Value #A":4,
"Value #B":6,
"Value #C":9,
"Value #D":10,
"Value #E":8,
"Value #F":14,
"Value #G":7,
"Value #H":11,
"Value #I":12,
"Value #J":5,
"Value #K":13,
"Value #L":3,
"Value #M":1,
"Value #N":2,
"cls":27,
"ins":0,
"instance":28,
"ip 1":29,
"ip 2":31,
"job":30
},
"renameByName":{"Value #A":"Patroni Status","Value #B":"Timeline","Value #C":"XID","Value #D":"Paused","Value #E":"LSN","Value #F":"Descendant","Value #G":"Recv TLI","Value #H":"WAL","Value #I":"","Value #J":"TLI Sync","Value #K":"PG Uptime ","Value #L":"Patroni","Value #M":"Postgres","Value #N":"PG Status","cls":"Cluster","ins":"Instance","ip":"IP","scope":"Shard","state":"Replication"}
}
}
],
"type":"table"
},
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":20},"id":159,"panels":[],"title":"PITR","type":"row"},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"TransactionID xmax on each instance",
"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",
"showValues":false,
"spanNulls":false,
"stacking":{"group":"A","mode":"none"},
"thresholdsStyle":{"mode":"off"}
},
"mappings":[],
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},
"unit":"none"
},
"overrides":[{"matcher":{"id":"byName","options":"Current"},"properties":[{"id":"custom.lineWidth","value":1},{"id":"color","value":{"fixedColor":"super-light-orange","mode":"fixed"}},{"id":"custom.fillOpacity","value":20}]},{"matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}}]}]
},
"gridPos":{"h":10,"w":12,"x":0,"y":21},
"id":182,
"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_xact_xmax{cls=\"$cls\"}","hide":false,"interval":"","legendFormat":"{{ ins }}","range":true,"refId":"A"}],
"title":"XID Progress",
"type":"timeseries"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"Current WAL Sequence Number on each Instance",
"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":2,
"pointSize":5,
"scaleDistribution":{"type":"linear"},
"showPoints":"auto",
"showValues":false,
"spanNulls":false,
"stacking":{"group":"A","mode":"none"},
"thresholdsStyle":{"mode":"off"}
},
"mappings":[],
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0},{"color":"red","value":80}]},
"unit":"hex"
},
"overrides":[{"matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}}]}]
},
"gridPos":{"h":10,"w":12,"x":12,"y":21},
"id":184,
"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Name","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_lsn{cls=\"$cls\"}" , "interval":"","legendFormat":"{{ ins }}" ,"range":true,"refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"}, "exemplar":false,"expr":"pg_checkpoint_checkpoint_lsn{ins=\"$primary\"}" ,"hide":true,"interval":"","legendFormat":"Checkpoint Leader $primary" , "refId":"B" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"}, "exemplar":false,"expr":"pg_checkpoint_checkpoint_lsn{cls=\"$cls\", ins!=\"$primary\"}","hide":true,"interval":"","legendFormat":"Checkpoint Follower {{ ins }}", "refId":"C" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"}, "exemplar":false,"expr":"pg_checkpoint_redo_lsn{cls=\"$cls\", ins!=\"$primary\"}" ,"hide":true,"interval":"","legendFormat":"Redo {{ ins }}" , "refId":"D" }
],
"title":"LSN Progress",
"type":"timeseries"
},
{
"collapsed":true,
"gridPos":{"h":1,"w":24,"x":0,"y":31},
"id":207,
"panels":[
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"pg_basebackup progress (re-create replica)",
"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",
"showValues":false,
"spanNulls":false,
"stacking":{"group":"A","mode":"none"},
"thresholdsStyle":{"mode":"off"}
},
"mappings":[],
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},
"unit":"percentunit"
},
"overrides":[{"matcher":{"id":"byName","options":"Current"},"properties":[{"id":"custom.lineWidth","value":1},{"id":"color","value":{"fixedColor":"super-light-orange","mode":"fixed"}},{"id":"custom.fillOpacity","value":20}]},{"matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}}]}]
},
"gridPos":{"h":6,"w":12,"x":0,"y":32},
"id":206,
"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_backup_sent_bytes{cls=\"$cls\"} / pg_backup_total_bytes{cls=\"$cls\"}","hide":false,"interval":"","legendFormat":"{{ ins }}","range":true,"refId":"A"}],
"title":"Basebackup Progress",
"type":"timeseries"
},{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"pg_basebackup progress (re-create replica)",
"fieldConfig":{
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"footer":{"reducers":[]},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},"unit":"decbytes"},
"overrides":[
{ "matcher":{"id":"byName","options":"Sent"} ,"properties":[{"id":"unit","value":"decbytes"},{"id":"custom.width","value":120}] },
{ "matcher":{"id":"byName","options":"PID"} ,"properties":[{"id":"unit","value":"none"},{"id":"custom.width","value":120}] },
{ "matcher":{"id":"byName","options":"Total"},"properties":[{"id":"custom.width","value":120}] },
{ "matcher":{"id":"byName","options":"Ratio"},"properties":[{"id":"unit","value":"percentunit"},{"id":"custom.cellOptions","value":{"type":"gauge"}},{"id":"max","value":1},{"id":"color","value":{"mode":"continuous-RdYlGr"}},{"id":"custom.minWidth","value":200},{"id":"min","value":0}] }
]
},
"gridPos":{"h":6,"w":12,"x":12,"y":32},
"id":208,
"options":{"cellHeight":"sm","showHeader":true},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_backup_sent_phase{cls=\"$cls\"}" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ ins }}","range":false,"refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_backup_sent_bytes{cls=\"$cls\"}" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ ins }}","range":false,"refId":"B" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_backup_total_bytes{cls=\"$cls\"}" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ ins }}","range":false,"refId":"C" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_backup_sent_bytes{cls=\"$cls\"} / pg_backup_total_bytes{cls=\"$cls\"}","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ ins }}","range":false,"refId":"D" }
],
"title":"Basebackup Progress",
"transformations":[
{ "id":"joinByField" ,"options":{"byField":"pid","mode":"outer"} },
{ "id":"filterFieldsByName","options":{"byVariable":false,"include":{"names":["pid","Value #B","Value #C","Value #D","ins 1"],"pattern":"pid|Value.*"}} },
{ "id":"organize" ,"options":{"excludeByName":{"Time 1":true,"__name__ 1":true,"cls 1":true,"ins 1":true,"instance 1":true,"ip 1":true,"job 1":true},"includeByName":{},"indexByName":{"Value #B":2,"Value #C":3,"Value #D":1,"ins":4,"pid":0},"renameByName":{"Value #B":"Sent","Value #C":"Total","Value #D":"Ratio","ins":"Instance","pid":"PID"}} }
],
"type":"table"
}
],
"title":"Base Backup",
"type":"row"
},
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":32},"id":192,"panels":[],"title":"Replication","type":"row"},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"Replication Status among cluster ${cls}",
"fieldConfig":{
"defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"filterable":false,"footer":{"reducers":[]},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#e3e3e3e0","value":0}]}},
"overrides":[
{
"matcher":{"id":"byName","options":"STATE"},
"properties":[
{ "id":"custom.width" ,"value":100 },
{ "id":"mappings" ,"value":[{"options":{"-1":{"color":"#a352ccbf","index":0,"text":"unknown"},"0":{"color":"#346f36cc","index":1,"text":"streaming"},"1":{"color":"#e02f44bf","index":2,"text":"startup"},"2":{"color":"#f2cc0cbf","index":3,"text":"catchup"},"3":{"color":"#3275d9bf","index":4,"text":"backup"},"4":{"color":"#ff780abf","index":5,"text":"stopping"}},"type":"value"}] },
{ "id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"} }
]
},
{"matcher":{"id":"byName","options":"TLI"},"properties":[{"id":"custom.width","value":60}]},
{
"matcher":{"id":"byName","options":"SYNC"},
"properties":[
{ "id":"mappings" ,"value":[{"options":{"-1":{"color":"#a352ccbf","index":4,"text":"unknown"},"0":{"color":"#346f36cc","index":0,"text":"async"},"1":{"color":"#f2cc0cbf","index":1,"text":"potential"},"2":{"color":"#3275d9bf","index":2,"text":"sync"},"3":{"color":"#ff780abf","index":3,"text":"quorum"}},"type":"value"}] },
{ "id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"} },
{ "id":"custom.width" ,"value":90 }
]
},
{"matcher":{"id":"byName","options":"SRC"},"properties":[{"id":"links","value":[{"title":"PGSQL Instance for replication source instance ${__data.fields.SRC}","url":"/d/pgsql-instance?var-ins=${__data.fields.SRC}&${__url_time_range}"}]}]},
{"matcher":{"id":"byName","options":"DST"},"properties":[{"id":"links","value":[{"title":"PGSQL Instance for replication destination instance ${__data.fields.DST}","url":"/d/pgsql-instance?var-ins=${__data.fields.DST}&${__url_time_range}"}]}]},
{"matcher":{"id":"byName","options":"SRC IP"},"properties":[{"id":"custom.width","value":100},{"id":"links","value":[{"title":"PGSQL Node : ${__data.fields[\"SRC IP\"]}","url":"/d/node-instance?var-id=${__data.fields[\"SRC IP\"]}&${__url_time_range}"}]}]},
{"matcher":{"id":"byName","options":"DST IP"},"properties":[{"id":"custom.width","value":100},{"id":"links","value":[{"title":"PGSQL Node: ${__data.fields[\"DST IP\"]}","url":"/d/node-instance?var-id=${__data.fields[\"DST IP\"]}&${__url_time_range}"}]}]}
]
},
"gridPos":{"h":7,"w":12,"x":0,"y":33},
"id":167,
"links":[{"title":"PGSQL Replication : ${cls}","url":"/d/pgsql-replication?var-cls=${cls}&${__url_time_range}"}],
"options":{"cellHeight":"sm","showHeader":true,"sortBy":[]},
"pluginVersion":"12.3.1",
"targets":[
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"exemplar":false,"expr":"pg:cls:sender{cls=\"$cls\"}" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"A" },
{ "datasource":{"type":"prometheus","uid":"ds-prometheus"},"exemplar":false,"expr":"pg:cls:receiver{cls=\"$cls\"}","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" }
],
"title":"Replication",
"transformations":[
{"id":"seriesToColumns","options":{"byField":"appname"}},
{
"id":"organize",
"options":{
"excludeByName":{"Time":true,"Time 1":true,"Time 2":true,"Value #A":false,"__name__":true,"__name__ 1":true,"__name__ 2":true,"address":true,"cls":true,"cls 1":true,"cls 2":true,"ip":false,"job":true,"job 1":true,"job 2":true,"pid":true,"sender_host":true,"sender_port":true,"usename":true},
"indexByName":{"Time 1":11,"Time 2":15,"Value #A":1,"Value #B":7,"__name__ 1":12,"__name__ 2":16,"address":13,"appname":3,"cls 1":14,"cls 2":17,"ins":2,"ip 1":4,"ip 2":5,"job 1":19,"job 2":20,"pid":8,"sender_host":10,"sender_port":18,"slot_name":6,"state":0,"usename":9},
"renameByName":{"Value":"TLI","Value #A":"SYNC","Value #B":"TLI","address":"","appname":"DST","ins":"SRC","ip 1":"SRC IP","ip 2":"DST IP","pid":"PID","sender_host":"","sender_port":"","slot_name":"SLOT","state":"STATE","usename":"USER"}
}
}
],
"type":"table"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"fieldConfig":{
"defaults":{
"color":{"mode":"palette-classic"},
"custom":{
"axisBorderShow":false,
"axisCenteredZero":false,
"axisColorMode":"text",
"axisLabel":"",
"axisPlacement":"auto",
"barAlignment":0,
"barWidthFactor":0.6,
"drawStyle":"line",
"fillOpacity":30,
"gradientMode":"none",
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
"insertNulls":false,
"lineInterpolation":"linear",
"lineWidth":1,
"pointSize":2,
"scaleDistribution":{"type":"linear"},
"showPoints":"always",
"showValues":false,
"spanNulls":false,
"stacking":{"group":"A","mode":"none"},
"thresholdsStyle":{"mode":"off"}
},
"links":[{"title":"PGSQL Instance for ${__field.labels.appname}","url":"/d/pgsql-instance?var-ins=${__field.labels.appname}&${__url_time_range}"}],
"mappings":[],
"min":0,
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},
"unit":"decbytes"
},
"overrides":[]
},
"gridPos":{"h":7,"w":12,"x":12,"y":33},
"id":213,
"options":{"legend":{"calcs":["max","last"],"displayMode":"table","placement":"bottom","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[{"exemplar":false,"expr":"pg_repl_replay_diff{cls=\"$cls\"}","interval":"","legendFormat":"{{ ins }} \u2192 {{ usename }}:{{ appname }}@{{ address }}","refId":"A"}],
"title":"Replication Lag in Bytes",
"type":"timeseries"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"",
"fieldConfig":{
"defaults":{
"color":{"mode":"thresholds"},
"links":[{"title":"PGSQL Cluster Replication : ${cls}","url":"/d/pgsql-replication?var-cls=${cls}&viewPanel=56&${__url_time_range}"}],
"mappings":[{"options":{"1":{"color":"#3e668f","index":0,"text":"Leader"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"#cc4637d9","index":1,"text":"Loser"}},"type":"special"}],
"max":1,
"min":0,
"thresholds":{"mode":"absolute","steps":[{"color":"#cc4637d9","value":0},{"color":"#346f36cc","value":1}]},
"unit":"none"
},
"overrides":[]
},
"gridPos":{"h":6,"w":3,"x":0,"y":40},
"id":123,
"options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["last"],"fields":"","values":false},"showPercentChange":false,"text":{"valueSize":16},"textMode":"auto","wideLayout":true},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"exemplar":false,"expr":"pg:cls:leader{cls=\"$cls\"}","interval":"","legendFormat":"{{ ins }}","refId":"A"}],
"type":"stat"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"description":"Leadership shows who is in charge of this cluster ${cls}",
"fieldConfig":{
"defaults":{
"color":{"mode":"palette-classic"},
"custom":{
"axisBorderShow":false,
"axisCenteredZero":false,
"axisColorMode":"text",
"axisLabel":"",
"axisPlacement":"hidden",
"axisSoftMin":0,
"barAlignment":0,
"barWidthFactor":0.6,
"drawStyle":"line",
"fillOpacity":57,
"gradientMode":"none",
"hideFrom":{"graph":false,"legend":false,"tooltip":false,"viz":false},
"insertNulls":false,
"lineInterpolation":"stepBefore",
"lineWidth":0,
"pointSize":1,
"scaleDistribution":{"type":"linear"},
"showPoints":"auto",
"showValues":false,
"spanNulls":false,
"stacking":{"group":"A","mode":"none"},
"thresholdsStyle":{"mode":"off"}
},
"links":[{"title":"PGSQL Instance : ${__field.labels.ins}","url":"/d/pgsql-instance?var-ins=${__field.labels.ins}&${__url_time_range}"}],
"mappings":[],
"max":1,
"min":0,
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},
"unit":"none"
},
"overrides":[{"matcher":{"id":"byType","options":"time"},"properties":[{"id":"custom.axisPlacement","value":"auto"}]}]
},
"gridPos":{"h":6,"w":9,"x":3,"y":40},
"id":158,
"links":[{"title":"PGSQL Replication : ${cls} ${__url_time_range}","url":"/d/pgsql-replication?var-cls=${cls}&${__url_time_range}"}],
"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"(pg_in_recovery{cls=\"$cls\"} == 0) * 0 + 1","interval":"","legendFormat":"{{ ins }}","range":true,"refId":"A"}],
"title":"Leadership",
"type":"timeseries"
},
{
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"fieldConfig":{
"defaults":{
"color":{"mode":"palette-classic"},
"custom":{
"axisBorderShow":false,
"axisCenteredZero":false,
"axisColorMode":"text",
"axisLabel":"",
"axisPlacement":"auto",
"barAlignment":0,
"barWidthFactor":0.6,
"drawStyle":"line",
"fillOpacity":25,
"gradientMode":"hue",
"hideFrom":{"legend":false,"tooltip":false,"viz":false},
"insertNulls":false,
"lineInterpolation":"stepBefore",
"lineWidth":1,
"pointSize":5,
"scaleDistribution":{"type":"linear"},
"showPoints":"auto",
"showValues":false,
"spanNulls":false,
"stacking":{"group":"A","mode":"none"},
"thresholdsStyle":{"mode":"off"}
},
"decimals":0,
"mappings":[],
"min":0,
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},
"unit":"none"
},
"overrides":[]
},
"gridPos":{"h":6,"w":12,"x":12,"y":40},
"id":165,
"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg_timeline_id{cls=\"$cls\"}","interval":"","legendFormat":"{{ ins }}","range":true,"refId":"A"}],
"title":"Timeline",
"type":"timeseries"
},
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":46},"id":170,"panels":[],"title":"Logs","type":"row"},
{
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
"description":"PostgreSQL / PgBackrest Logs Event",
"fieldConfig":{
"defaults":{
"color":{"fixedColor":"#346f36cc","mode":"palette-classic"},
"custom":{
"axisBorderShow":false,
"axisCenteredZero":false,
"axisColorMode":"text",
"axisLabel":"",
"axisPlacement":"auto",
"barAlignment":0,
"barWidthFactor":0.6,
"drawStyle":"bars",
"fillOpacity":100,
"gradientMode":"none",
"hideFrom":{"graph":false,"legend":false,"tooltip":false,"viz":false},
"insertNulls":false,
"lineInterpolation":"linear",
"lineWidth":1,
"pointSize":5,
"scaleDistribution":{"type":"linear"},
"showPoints":"never",
"showValues":false,
"spanNulls":true,
"stacking":{"group":"A","mode":"normal"},
"thresholdsStyle":{"mode":"off"}
},
"decimals":0,
"mappings":[],
"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc","value":0}]},
"unit":"none"
},
"overrides":[]
},
"gridPos":{"h":5,"w":24,"x":0,"y":47},
"id":201,
"interval":"1s",
"options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:in(\"postgres\", \"pgbackrest\") ip:in(${members:doublequote}) | stats by (ins,job) count() as count","legendFormat":"{{ ins }}.{{ job }}","queryType":"statsRange","refId":"A"}],
"title":"Logs",
"type":"timeseries"
},
{
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
"description":"Recent logs for pgbackrest",
"gridPos":{"h":17,"w":16,"x":0,"y":52},
"id":202,
"options":{"dedupStrategy":"none","enableInfiniteScrolling":false,"enableLogDetails":true,"fontSize":"small","prettifyLogMessage":false,"showCommonLabels":false,"showControls":true,"showLabels":true,"showTime":true,"sortOrder":"Descending","syntaxHighlighting":true,"wrapLogMessage":false},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:pgbackrest ip:in(${members:doublequote}) $search | fields level, topic, ins, _msg","instant":false,"queryType":"instant","range":true,"refId":"A"}],
"title":"Pgbackrest Logs",
"type":"logs"
},
{
"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
"description":"",
"gridPos":{"h":17,"w":8,"x":16,"y":52},
"id":173,
"options":{"dedupStrategy":"none","enableInfiniteScrolling":false,"enableLogDetails":true,"fontSize":"small","prettifyLogMessage":false,"showCommonLabels":false,"showControls":true,"showLabels":true,"showTime":true,"sortOrder":"Descending","syntaxHighlighting":true,"wrapLogMessage":false},
"pluginVersion":"12.3.1",
"targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"direction":"desc","editorMode":"code","expr":"job:postgres ip:in(${members:doublequote}) $search \n| fields level,ins,_msg","instant":false,"queryType":"instant","range":true,"refId":"A"}],
"title":"PostgreSQL Logs",
"type":"logs"
},
{"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":69},"id":193,"panels":[],"title":"Docs","type":"row"},
{
"gridPos":{"h":33,"w":24,"x":0,"y":70},
"id":194,
"links":[{"targetBlank":true,"title":"Pigsty Docs: PITR","url":"https://pigsty.io/docs/pgsql/backup/restore"}],
"options":{
"code":{"language":"plaintext","showLineNumbers":false,"showMiniMap":false},
"content":"[Pigsty Backup & Restore Docs](https://pigsty.io/docs/pgsql/backup)\n\n### By Time\n\nThe most frequently used target is the time point; you can specify the time point to restore to:\n\n```bash title=\"restore to a timepoint\"\n./pgsql-pitr.yml -l ${cls} -e '{\"pg_pitr\": { \"time\": \"2025-07-13 10:00:00+00\" }}'\n```\n\nTime should be a valid PostgreSQL [`TIMESTAMP`](https://www.postgresql.org/docs/17/datatype-datetime.html#DATATYPE-DATETIME-INPUT-TIME-STAMPS), `YYYY-MM-DD HH:MM:SS+TZ` is recommended.\n\n\n### By Name\n\nYou can create a named restore point with [`pg_create_restore_point`](https://www.postgresql.org/docs/current/functions-admin.html#id-1.5.8.34.5.5.2.2.1.1.1.1):\n\n```sql\nSELECT pg_create_restore_point('shit_incoming');\n```\n\nAnd use that named restore point in PITR:\n\n```bash\n./pgsql-pitr.yml -l ${cls} -e '{\"pg_pitr\": { \"name\": \"shit_incoming\" }}'\n```\n\n\n### By XID\n\nIf you have a transaction that accidentally deleted some data, the best way to recover is to restore the database to the state before that transaction.\n\n```bash title=\"restore right before a transaction\"\n./pgsql-pitr.yml -l ${cls} -e '{\"pg_pitr\": { \"xid\": \"250000\", exclusive: true }}'\n```\n\nYou can find the exact transaction id from monitoring dashboard, or find it from `TXID` from the CSVLOG.\n\n\n### By LSN\n\nPostgreSQL uses the [LSN](https://www.postgresql.org/docs/current/datatype-pg-lsn.html) (Log Sequence Number) to identify the position of a WAL record.\nYou can find it everywhere, like the PG LSN panel from Pigsty dashboards.\n\n```bash title=\"restore to a LSN\"\n./pgsql-pitr.yml -l ${cls} -e '{\"pg_pitr\": { \"lsn\": \"0/4001C80\", timeline: \"1\" }}'\n```\n\nTo restore to an exact point in the WAL stream, you may also specify the [`timeline`](https://www.postgresql.org/docs/current/runtime-config-wal.html#RECOVERY-TARGET-TIMELINE) parameter (default to `latest`)",
"mode":"markdown"
},
"pluginVersion":"12.3.1",
"title":"PITR Docs",
"type":"text"
}
],
"preload":false,
"refresh":"10s",
"schemaVersion":42,
"tags":["Pigsty","PGSQL","Cluster"],
"templating":{
"list":[
{
"current":{},
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"definition":"label_values(pg_up, cls)",
"description":"Cluster identifier for this postgres instance, cls should be unique among entire environment. such as pg-meta, pg-test",
"includeAll":false,
"label":"Cluster",
"name":"cls",
"options":[],
"query":{"query":"label_values(pg_up, cls)","refId":"StandardVariableQuery"},
"refresh":2,
"regex":"",
"sort":1,
"type":"query"
},{
"current":{},
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"definition":"label_values(pg:cls:leader{cls=\"$cls\"}, ins)",
"description":"Unique instance identifier (e.g pg-meta-1)",
"hide":2,
"includeAll":false,
"label":"Primary",
"name":"primary",
"options":[],
"query":{"query":"label_values(pg:cls:leader{cls=\"$cls\"}, ins)","refId":"StandardVariableQuery"},
"refresh":2,
"regex":"",
"sort":1,
"type":"query"
},{
"current":{},
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"definition":"label_values(pgbackrest_repo_status{cls=\"$cls\"},stanza)",
"description":"Available Stanza in this cluster's pgbackrest repo",
"includeAll":false,
"label":"Stanza",
"name":"stanza",
"options":[],
"query":{"qryType":1,"query":"label_values(pgbackrest_repo_status{cls=\"$cls\"},stanza)","refId":"PrometheusVariableQueryEditor-VariableQuery"},
"refresh":2,
"regex":"",
"sort":1,
"type":"query"
},{
"current":{},
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"definition":"label_values(pg_up{cls=\"$cls\"}, ip)",
"description":"Unique instance identifier (e.g pg-meta-1)",
"hide":2,
"includeAll":true,
"label":"Primary",
"multi":true,
"name":"members",
"options":[],
"query":{"query":"label_values(pg_up{cls=\"$cls\"}, ip)","refId":"StandardVariableQuery"},
"refresh":2,
"regex":"",
"sort":1,
"type":"query"
},{
"current":{},
"datasource":{"type":"prometheus","uid":"ds-prometheus"},
"definition":"label_values(node_load1{ip=~\"$members\"},cls)",
"description":"Node Cluster Identifier",
"hide":2,
"includeAll":false,
"label":"Node Cluster",
"name":"node_cls",
"options":[],
"query":{"query":"label_values(node_load1{ip=~\"$members\"},cls)","refId":"PrometheusVariableQueryEditor-VariableQuery"},
"refresh":2,
"regex":"",
"sort":1,
"type":"query"
},
{"current":{},"description":"LogsQL query on pgbackrest / postgres logs","label":"Search","name":"search","options":[{"selected":true,"text":"","value":""}],"query":"","type":"textbox"}
]
},
"time":{"from":"now-1h","to":"now"},
"timepicker":{},
"timezone":"browser",
"title":"PGSQL PITR",
"uid":"pgsql-pitr",
"version":1,
"weekStart":""
}