{
  "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 Instance Dashboard",
  "editable":true,
  "fiscalYearStartMonth":0,
  "graphTooltip":0,
  "id":null,
  "license":"https://pigsty.io/docs/about/license/",
  "links":[
    { "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":137,"panels":[],"title":"Overview","type":"row"},
    {
      "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},
      "description":"",
      "fieldConfig":{
        "defaults":{"color":{"mode":"thresholds"},"mappings":[],"max":2.5,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"#3e668f","value":0}]}},
        "overrides":[
          { "matcher":{"id":"byFrameRefID","options":"A"},"properties":[{"id":"links","value":[{"title":"PGSQL Instance : ${ins}","url":"/d/pgsql-instance?var-ins=${ins}&${__url_time_range}"}]}] },{ "matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"links","value":[{"title":"PGSQL Cluster : ${cls}","url":"/d/pgsql-cluster?var-cls=${cls}&${__url_time_range}"}]}]   },
          { "matcher":{"id":"byFrameRefID","options":"C"},"properties":[{"id":"links","value":[{"title":"Node Instance : ${ip}","url":"/d/node-instance?var-id=${ip}&${__url_time_range}"}]}]      },{ "matcher":{"id":"byFrameRefID","options":"D"},"properties":[{"id":"links","value":[{"title":"Node Instance : ${node}","url":"/d/node-instance?var-id=${node}&${__url_time_range}"}]}]  }
        ]
      },
      "gridPos":{"h":6,"w":6,"x":0,"y":1},
      "id":148,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"horizontal","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"/.*/","values":true},"showPercentChange":false,"text":{"titleSize":16,"valueSize":16},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Instance","type":"string","values":["$ins"]}],"meta":{},"name":""} ,"hide":false,"refId":"A" },
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Cluster","type":"string","values":["${cls}"]}],"meta":{},"name":""},"hide":false,"refId":"B" },
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Node IP","type":"string","values":["${ip}"]}],"meta":{},"name":""} ,"hide":false,"refId":"C" },
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Hostname","type":"string","values":["${node}"]}],"meta":{}}        ,"hide":false,"refId":"D" }
      ],
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Exporter Aliveness Status in ${cls}\n\nInstance: Goto PGSQL Instance\n\nIP: Goto PGSQL Node\n\nStatus: Goto PGSQL Service\n\nLoad: max(cpu,postgres,pgbouncer)\n\nSpace: Disk space usage max(all device)\n\nProxy: session number, Goto Haproxy Admin Page",
      "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":"byRegexp","options":"/postgres|pgbouncer|pgbackrest/"},"properties":[{"id":"mappings","value":[{"options":{"0":{"color":"#cc4637d9","index":0,"text":"DOWN"},"1":{"color":"#346f36cc","index":1,"text":"UP"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":100}] },
          { "matcher":{"id":"byRegexp","options":"/.*up/"}                         ,"properties":[{"id":"unit","value":"s"},{"id":"custom.width","value":110}]                                                                                                                                                                                                  },
          { "matcher":{"id":"byName","options":"Instance"}                         ,"properties":[{"id":"links","value":[{"title":"PGSQL Exporter : ${__data.fields.Instance}","url":"/d/pgsql-exporter?var-ins=${__data.fields.Instance}&${__url_time_range}"}]}]                                                                                              }
        ]
      },
      "gridPos":{"h":6,"w":10,"x":6,"y":1},
      "id":144,
      "links":[{"title":"PGSQL Instance : ${primary}","url":"/d/pgsql-instance?var-ins=${primary}&${__url_time_range}"}],
      "options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":false,"displayName":"pg uptime"}]},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_exporter_agent_up{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) (pgbouncer_exporter_agent_up{cls=\"$cls\"})" ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"__auto","refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pgbackrest_exporter_agent_up{cls=\"$cls\"})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":""      ,"refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_exporter_uptime{cls=\"$cls\"})"          ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":""      ,"refId":"F" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pgbouncer_exporter_uptime{cls=\"$cls\"})"   ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":""      ,"refId":"G" }
      ],
      "title":"Export Status",
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"ins","mode":"outer"}},
        {
          "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 #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":true,
              "instance 1":true,
              "instance 2":false,
              "instance 3":true,
              "instance 4":true,
              "instance 5":true,
              "instance 6":true,
              "ip 1":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":5,"Time 2":6,"Time 3":7,"Time 4":8,"Value #A":1,"Value #B":2,"Value #C":3,"Value #D":4,"ins":0},
            "renameByName":{"Time 4":"","Value #A":"postgres","Value #B":"pgbouncer","Value #C":"pgbackrest","Value #D":"pgb uptime","Value #E":"DB Conn","Value #F":"pg uptime","Value #G":"pgb uptime","Value #H":"LB","Value #I":"QPS","Value #J":"LB Clients","Value #K":"Lag","cls 1":"","cls 2":"","ins":"Instance","instance":"","instance 2":"","ip":"IP","ip 1":"IP"}
          }
        }
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":12,
            "gradientMode":"opacity",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":2,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "links":[],
          "mappings":[{"options":{"0":{"index":0,"text":"Dead"},"1":{"index":1,"text":"UP"}},"type":"value"}],
          "max":1.2,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":6,"w":8,"x":16,"y":1},
      "id":145,
      "options":{"legend":{"calcs":["min"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Min","sortDesc":false},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_agent_up{ins=\"$ins\"}"        ,             "legendFormat":"pg_exporter"        ,"range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_agent_up{ins=\"$ins\"}" ,             "legendFormat":"pgbouncer_exporter" ,"range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_up{ins=\"$ins\"}"                       ,"hide":false,"legendFormat":"postgres"           ,"range":true,"refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_up{ins=\"$ins\"}"                ,"hide":false,"legendFormat":"pgbouncer"          ,"range":true,"refId":"D" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"patroni_up{ins=\"$ins\"}"                  ,"hide":false,"legendFormat":"patroni"            ,"range":true,"refId":"E" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbackrest_exporter_agent_up{ins=\"$ins\"}","hide":false,"legendFormat":"pgbackrest_exporter","range":true,"refId":"F" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"up{ins=\"$ins\", job=~\"pgsql|pgrds\"}"    ,"hide":true ,"legendFormat":"{{ instance }}"     ,"range":true,"refId":"Z" }
      ],
      "title":"Aliveness",
      "type":"timeseries"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":7},"id":142,"panels":[],"title":"Global Status","type":"row"},
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "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":"opacity",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "links":[],
          "mappings":[{"options":{"0":{"index":0,"text":"Dead"},"1":{"index":1,"text":"UP"}},"type":"value"}],
          "max":1.2,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":6,"w":12,"x":0,"y":8},
      "id":139,
      "options":{"legend":{"calcs":["min"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Min","sortDesc":false},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_agent_up{}","legendFormat":"{{ instance }}","range":true,"refId":"A"},{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_agent_up{}","legendFormat":"{{ instance }}","range":true,"refId":"B"}],
      "title":"Aliveness",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"All instances among pgsql cluster ${cls}\n\nInstance: Goto PGSQL Instance\n\nIP: Goto PGSQL Node\n\nStatus: Goto PGSQL Service\n\nLoad: max(cpu,postgres,pgbouncer)\n\nSpace: Disk space usage max(all device)\n\nProxy: session number, Goto Haproxy Admin Page",
      "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":"byRegexp","options":"/pg_exporter|pgb_exporter/"},"properties":[{"id":"mappings","value":[{"options":{"0":{"color":"#cc4637d9","index":0,"text":"DOWN"},"1":{"color":"#346f36cc","index":1,"text":"UP"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}},{"id":"custom.width","value":110}] },
          { "matcher":{"id":"byRegexp","options":"/.*up/"}                    ,"properties":[{"id":"unit","value":"s"},{"id":"custom.width","value":110}]                                                                                                                                                                                                  },
          { "matcher":{"id":"byName","options":"Instance"}                    ,"properties":[{"id":"links","value":[{"title":"PGSQL Exporter : ${__data.fields.Instance}","url":"/d/pgsql-exporter?var-ins=${__data.fields.Instance}&${__url_time_range}"}]}]                                                                                              }
        ]
      },
      "gridPos":{"h":12,"w":12,"x":12,"y":8},
      "id":141,
      "links":[{"title":"PGSQL Instance : ${primary}","url":"/d/pgsql-instance?var-ins=${primary}&${__url_time_range}"}],
      "options":{"cellHeight":"sm","showHeader":true,"sortBy":[{"desc":false,"displayName":"pg uptime"}]},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_exporter_agent_up{})"       ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pgbouncer_exporter_agent_up{})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg_exporter_uptime{})"         ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pgbouncer_exporter_uptime{})"  ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"D" }
      ],
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"ins","mode":"outer"}},
        {
          "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 #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":true,
              "instance 1":true,
              "instance 2":false,
              "instance 3":true,
              "instance 4":true,
              "instance 5":true,
              "instance 6":true,
              "ip 1":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
            },
            "indexByName":{"Time 1":5,"Time 2":6,"Time 3":7,"Time 4":8,"Value #A":1,"Value #B":2,"Value #C":3,"Value #D":4,"ins":0},
            "renameByName":{"Time 4":"","Value #A":"pg_exporter","Value #B":"pgb_exporter","Value #C":"pg uptime","Value #D":"pgb uptime","Value #E":"DB Conn","Value #F":"RT","Value #G":"LB Conn","Value #H":"LB","Value #I":"QPS","Value #J":"LB Clients","Value #K":"Lag","cls 1":"","cls 2":"","ins":"Instance","instance":"","instance 2":"","ip":"IP","ip 1":"IP"}
          }
        }
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"points",
            "fillOpacity":0,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":0,
            "pointSize":2,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"s"
        },
        "overrides":[]
      },
      "gridPos":{"h":6,"w":12,"x":0,"y":14},
      "id":138,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Mean","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_scrape_duration{}","legendFormat":"{{ ins }}","range":true,"refId":"A"}],
      "title":"Scrape Duration",
      "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":0,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "links":[],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"s"
        },
        "overrides":[{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]}]
      },
      "gridPos":{"h":6,"w":12,"x":0,"y":20},
      "id":146,
      "options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Last","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_uptime{}","legendFormat":"{{ ins }}","range":true,"refId":"A"},{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_uptime{}","hide":false,"legendFormat":"{{ ins }}","range":true,"refId":"B"}],
      "title":"Global Uptime",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Error Increase in last 1 minute",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":12,
            "gradientMode":"opacity",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":2,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":6,"w":12,"x":12,"y":20},
      "id":147,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Name","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pg_exporter_scrape_error_count{}[1m])","legendFormat":"{{ ins }}","range":true,"refId":"A"},{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pgbouncer_exporter_scrape_error_count{}[1m])","legendFormat":"{{ ins }}","range":true,"refId":"B"}],
      "title":"Global Error Rate",
      "type":"timeseries"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":26},"id":130,"panels":[],"title":"Metrics","type":"row"},
    {
      "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":10,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "links":[],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0},{"color":"red","value":80}]},
          "unit":"s"
        },
        "overrides":[{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]}]
      },
      "gridPos":{"h":5,"w":12,"x":0,"y":27},
      "id":124,
      "options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_uptime{ins=\"$ins\"}","legendFormat":"postgres","range":true,"refId":"A"},{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_uptime{ins=\"$ins\"}","hide":false,"legendFormat":"pgbouncer","range":true,"refId":"B"}],
      "title":"Up Time",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":12,
            "gradientMode":"opacity",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":2,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "links":[],
          "mappings":[{"options":{"0":{"index":0,"text":"Dead"},"1":{"index":1,"text":"UP"}},"type":"value"}],
          "max":1.2,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":5,"w":12,"x":12,"y":27},
      "id":128,
      "options":{"legend":{"calcs":["min"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Min","sortDesc":false},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_agent_up{ins=\"$ins\"}"        ,             "legendFormat":"postgres"      ,"range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_agent_up{ins=\"$ins\"}" ,             "legendFormat":"pgbouncer"     ,"range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbackrest_exporter_agent_up{ins=\"$ins\"}","hide":false,"legendFormat":"pgbackrest"    ,"range":true,"refId":"D" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"up{ins=\"$ins\", job=~\"pgsql|pgrds\"}"    ,"hide":true ,"legendFormat":"{{ instance }}","range":true,"refId":"C" }
      ],
      "title":"Exporter Aliveness",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "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":"stepAfter",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"s"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":5,"w":12,"x":0,"y":32},
      "id":129,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_scrape_duration{ins=\"$ins\"}","legendFormat":"postgres","range":true,"refId":"A"},{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_scrape_duration{ins=\"$ins\"}","hide":false,"legendFormat":"pgbouncer","range":true,"refId":"B"}],
      "title":"Scrape Duration",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Error Increase in last 1 minute",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":12,
            "gradientMode":"opacity",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":2,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"postgres"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":5,"w":12,"x":12,"y":32},
      "id":136,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Name","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pg_exporter_scrape_error_count{ins=\"$ins\"}[1m])"       ,"legendFormat":"postgres" ,"range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pgbouncer_exporter_scrape_error_count{ins=\"$ins\"}[1m])","legendFormat":"pgbouncer","range":true,"refId":"B" }
      ],
      "title":"Errors Count Per Minute",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "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":"stepAfter",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"s"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]}]
      },
      "gridPos":{"h":5,"w":12,"x":0,"y":37},
      "id":125,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_server_scrape_duration{ins=\"$ins\"}"       ,             "legendFormat":"{{ datname }}","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_server_scrape_duration{ins=\"$ins\"}","hide":false,"legendFormat":"pgbouncer"    ,"range":true,"refId":"B" }
      ],
      "title":"Scrape Duration (per Server)",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Scrape Count",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":12,
            "gradientMode":"opacity",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":2,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":1,
          "links":[],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"Error"},"properties":[{"id":"color","value":{"fixedColor":"#E02F44","mode":"fixed"}},{"id":"unit","value":"short"},{"id":"min","value":0},{"id":"max","value":0.1}]}]
      },
      "gridPos":{"h":5,"w":12,"x":12,"y":37},
      "id":126,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pg_exporter_server_scrape_total_count{ins=\"$ins\"}[1m])"       ,"legendFormat":"{{ datname }}","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pgbouncer_exporter_server_scrape_total_count{ins=\"$ins\"}[1m])","legendFormat":"pgbouncer"    ,"range":true,"refId":"B" }
      ],
      "title":"Scrape Count Per Minute",
      "type":"timeseries"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":42},"id":134,"panels":[],"title":"Collectors","type":"row"},
    {
      "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":10,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"line+area"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"transparent","value":0}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":6,"w":12,"x":0,"y":43},
      "id":123,
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Max","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"sum by (query) (increase(pg_exporter_query_scrape_error_count{ins=\"$ins\"}[1m]))","legendFormat":"{{query}}","range":true,"refId":"A"}],
      "title":"Query Errors",
      "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":2,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":6,"w":12,"x":12,"y":43},
      "id":132,
      "options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Last","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"sum by (query) (pg_exporter_query_scrape_metric_count{ins=\"$ins\"})"       ,             "legendFormat":"{{query}}","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"sum by (query) (pgbouncer_exporter_query_scrape_metric_count{ins=\"$ins\"})","hide":false,"legendFormat":"{{query}}","range":true,"refId":"B" }
      ],
      "title":"Metrics Count",
      "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":3,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0},{"color":"red","value":80}]},
          "unit":"s"
        },
        "overrides":[]
      },
      "gridPos":{"h":15,"w":24,"x":0,"y":49},
      "id":131,
      "options":{"legend":{"calcs":["mean","lastNotNull","max"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Mean","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pg_exporter_query_scrape_duration{ins=\"$ins\"}[1m]) / \nincrease(pg_exporter_query_scrape_total_count{ins=\"$ins\"}[1m])"              ,             "legendFormat":"{{ datname }}.{{ query }}","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pgbouncer_exporter_query_scrape_duration{ins=\"$ins\"}[1m]) / \nincrease(pgbouncer_exporter_query_scrape_total_count{ins=\"$ins\"}[1m])","hide":false,"legendFormat":"pgbouncer.{{ query }}"    ,"range":true,"refId":"B" }
      ],
      "title":"Query Duration",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "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":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "links":[],
          "mappings":[],
          "max":1,
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0},{"color":"red","value":80}]},
          "unit":"percentunit"
        },
        "overrides":[]
      },
      "gridPos":{"h":9,"w":12,"x":0,"y":64},
      "id":133,
      "options":{"legend":{"calcs":["mean","lastNotNull","max"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pg_exporter_query_scrape_hit_count{ins=\"$ins\"}[5m]) / \nincrease(pg_exporter_query_scrape_total_count{ins=\"$ins\"}[5m])"              ,             "legendFormat":"{{ datname }}.{{query}}","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"increase(pgbouncer_exporter_query_scrape_hit_count{ins=\"$ins\"}[5m]) / \nincrease(pgbouncer_exporter_query_scrape_total_count{ins=\"$ins\"}[5m])","hide":false,"legendFormat":"{{ datname }}.{{query}}","range":true,"refId":"B" }
      ],
      "title":"Query Cache Hit Rate",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":1,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"stepAfter",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "showValues":false,
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green","value":0}]},
          "unit":"s"
        },
        "overrides":[{"matcher":{"id":"byName","options":"pgbouncer"},"properties":[{"id":"color","value":{"fixedColor":"#f79f64","mode":"fixed"}}]}]
      },
      "gridPos":{"h":9,"w":12,"x":12,"y":64},
      "id":135,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"desc"}},
      "pluginVersion":"12.3.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pg_exporter_query_cache_ttl{ins=\"$ins\"}"       ,             "legendFormat":"{{ datname }}.{{ query }}","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","expr":"pgbouncer_exporter_query_cache_ttl{ins=\"$ins\"}","hide":false,"legendFormat":"pgbouncer. {{ query }}"   ,"range":true,"refId":"B" }
      ],
      "title":"Cache TTL",
      "type":"timeseries"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":73},"id":98,"panels":[],"title":"Logs","type":"row"},
    {
      "datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
      "description":"Logs of pg_exporter, pgbouncer_exporter, and pgbackrest_exporter of instance $ins",
      "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":74},
      "id":100,
      "interval":"1s",
      "links":[{"title":"PG Exporter Logs for ${ins}","url":"/d/logs-instance?var-ins=$ins&var-src=syslog&var-search=exporter&${__url_time_range}"}],
      "options":{"legend":{"calcs":["sum"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:syslog ip:$ip unit:in(\"pg_exporter\", \"pgbouncer_exporter\", \"pgbackrest_exporter\") | stats by (unit) count() as count","legendFormat":"{{ unit }}","queryType":"statsRange","refId":"A"}],
      "title":"Exporter Logs",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},
      "description":"",
      "gridPos":{"h":15,"w":24,"x":0,"y":79},
      "id":102,
      "options":{"dedupStrategy":"none","detailsMode":"inline","enableInfiniteScrolling":true,"enableLogDetails":true,"fontSize":"small","prettifyLogMessage":false,"showCommonLabels":false,"showControls":true,"showLabels":true,"showTime":true,"sortOrder":"Descending","syntaxHighlighting":true,"wrapLogMessage":false},
      "pluginVersion":"12.3.0",
      "targets":[{"datasource":{"type":"victoriametrics-logs-datasource","uid":"ds-vlogs"},"editorMode":"code","expr":"job:syslog ip:$ip unit:in(\"pg_exporter\", \"pgbouncer_exporter\", \"pgbackrest_exporter\")","instant":false,"queryType":"instant","range":true,"refId":"A"}],
      "type":"logs"
    }
  ],
  "preload":false,
  "refresh":"",
  "schemaVersion":42,
  "tags":["Pigsty","PGSQL","Instance"],
  "templating":{
    "list":[
      {"current":{},"datasource":{"type":"prometheus","uid":"ds-prometheus"},"definition":"label_values(pg_up, ins)","description":"Unique instance identifier (e.g pg-meta-1)","includeAll":false,"label":"Instance","name":"ins","options":[],"query":{"query":"label_values(pg_up, ins)","refId":"StandardVariableQuery"},"refresh":1,"regex":"","sort":1,"type":"query"},
      {"current":{},"datasource":{"type":"prometheus","uid":"ds-prometheus"},"definition":"label_values(pg_up{ins=\"$ins\"} , ip)","description":"IP address of this postgres instance","hide":2,"includeAll":false,"label":"IP","name":"ip","options":[],"query":{"query":"label_values(pg_up{ins=\"$ins\"} , ip)","refId":"StandardVariableQuery"},"refresh":1,"regex":"","sort":1,"type":"query"},
      {
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_up{ins=\"$ins\"},  ins)",
        "description":"Sequence number of this instance, which is an unique integer among a postgres cluster",
        "hide":2,
        "includeAll":false,
        "label":"Sequence",
        "name":"seq",
        "options":[],
        "query":{"query":"label_values(pg_up{ins=\"$ins\"},  ins)","refId":"StandardVariableQuery"},
        "refresh":1,
        "regex":"/^[a-zA-Z0-9-_]+-(\\d+)$/",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_up{ins=\"$ins\"}, cls)",
        "description":"Cluster identifier for this postgres instance, cls should be unique among entire environment. such as pg-meta, pg-test",
        "hide":2,
        "includeAll":false,
        "label":"Cluster",
        "name":"cls",
        "options":[],
        "query":{"query":"label_values(pg_up{ins=\"$ins\"}, cls)","refId":"StandardVariableQuery"},
        "refresh":1,
        "regex":"",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(node_uname_info{ip=\"$ip\"},nodename)",
        "description":"Node name of current postgres instance",
        "hide":2,
        "includeAll":false,
        "label":"Node",
        "name":"node",
        "options":[],
        "query":{"query":"label_values(node_uname_info{ip=\"$ip\"},nodename)","refId":"PrometheusVariableQueryEditor-VariableQuery"},
        "refresh":1,
        "regex":"",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_db_age{ins=\"$ins\",datname!~'postgres|template0|template1'}, datname)",
        "description":"Non-trivial database in this instance",
        "hide":2,
        "includeAll":false,
        "label":"Database",
        "name":"datname",
        "options":[],
        "query":{"query":"label_values(pg_db_age{ins=\"$ins\",datname!~'postgres|template0|template1'}, datname)","refId":"StandardVariableQuery"},
        "refresh":1,
        "regex":"",
        "sort":1,
        "type":"query"
      }
    ]
  },
  "time":{"from":"now-1h","to":"now"},
  "timepicker":{},
  "timezone":"browser",
  "title":"PGSQL Exporter",
  "uid":"pgsql-exporter",
  "version":1,
  "weekStart":""
}