apiVersion: v1
kind: ConfigMap
metadata:
  name: postgresql
data:
  postgresql.json: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "description": "PostgreSQL dashboard for metrics exported by Prometheus",
      "editable": true,
      "gnetId": 455,
      "graphTooltip": 0,
      "id": 48,
      "iteration": 1630791591086,
      "links": [],
      "panels": [
        {
          "collapsed": false,
          "datasource": null,
          "gridPos": {
            "h": 1,
            "w": 24,
            "x": 0,
            "y": 0
          },
          "id": 31,
          "panels": [],
          "title": "Overview",
          "type": "row"
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "description": "User and system CPU time spent in seconds.",
          "fieldConfig": {
            "defaults": {
              "custom": {},
              "links": []
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 5,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 0,
            "y": 1
          },
          "hiddenSeries": false,
          "id": 67,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.0-beta1",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "irate(process_cpu_seconds_total{job=\"$host\"}[$interval])",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "CPU Time",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "CPU usage (sec)",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": true,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "s",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {
            "Resident Mem": "green",
            "Virtual Mem": "red"
          },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "description": "Virtual and Resident memory size in bytes",
          "fieldConfig": {
            "defaults": {
              "custom": {},
              "links": []
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 5,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 8,
            "y": 1
          },
          "hiddenSeries": false,
          "id": 69,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.0-beta1",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "process_resident_memory_bytes{job=\"$host\"}",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "Resident Mem",
              "refId": "A"
            },
            {
              "expr": "process_virtual_memory_bytes{job=\"$host\"}",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "Virtual Mem",
              "refId": "B"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Memory usage",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": true,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "decimals": null,
              "format": "decbytes",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {
            "Open file desc": "blue"
          },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "description": "Number of open file descriptors",
          "fieldConfig": {
            "defaults": {
              "custom": {},
              "links": []
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 5,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 16,
            "y": 1
          },
          "hiddenSeries": false,
          "id": 71,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.0-beta1",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "process_open_fds{job=\"$host\"}",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "Open file desc",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Open file descriptors",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": true,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "decimals": null,
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "#299c46",
            "rgba(237, 129, 40, 0.89)",
            "#d44a3a"
          ],
          "datasource": "prometheus",
          "decimals": null,
          "description": "",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "format": "dateTimeFromNow",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 3,
            "x": 0,
            "y": 10
          },
          "id": 65,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "80%",
          "prefix": "",
          "prefixFontSize": "80%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "process_start_time_seconds{job=\"$host\"} * 1000",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "thresholds": "",
          "title": "Uptime",
          "transparent": true,
          "type": "singlestat",
          "valueFontSize": "150%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "prometheus",
          "decimals": 0,
          "editable": true,
          "error": false,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "format": "ops",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 3,
            "x": 3,
            "y": 10
          },
          "height": "55px",
          "id": 11,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "dsType": "prometheus",
              "expr": "sum(irate(pg_stat_database_xact_commit{datname=~\"$db\",job=~\"$host\"}[$interval])) + sum(irate(pg_stat_database_xact_rollback{datname=~\"$db\",job=~\"$host\"}[$interval]))",
              "format": "time_series",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "intervalFactor": 1,
              "measurement": "postgresql",
              "policy": "default",
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "xact_commit"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  },
                  {
                    "params": [
                      "10s"
                    ],
                    "type": "non_negative_derivative"
                  }
                ]
              ],
              "step": 1800,
              "tags": [
                {
                  "key": "host",
                  "operator": "=~",
                  "value": "/^$host$/"
                }
              ]
            }
          ],
          "thresholds": "",
          "title": "Total transactions",
          "transparent": true,
          "type": "singlestat",
          "valueFontSize": "150%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "aliasColors": {
            "commits": "blue",
            "rollbacks": "red"
          },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "fieldConfig": {
            "defaults": {
              "custom": {},
              "links": []
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 18,
            "x": 6,
            "y": 10
          },
          "hiddenSeries": false,
          "id": 26,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "rightSide": false,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.0-beta1",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(rate(pg_stat_database_xact_commit{datname=~\"$db\",job=\"$host\"}[$interval]))",
              "intervalFactor": 1,
              "legendFormat": "commits",
              "metric": "pg_stat_database_xact_commit",
              "refId": "A",
              "step": 2
            },
            {
              "expr": "sum(rate(pg_stat_database_xact_rollback{datname=~\"$db\",job=\"$host\"}[$interval]))",
              "intervalFactor": 1,
              "legendFormat": "rollbacks",
              "metric": "pg_stat_database_xact_commit",
              "refId": "B",
              "step": 2
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Transactions",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": true,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "prometheus",
          "decimals": 2,
          "editable": true,
          "error": false,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "format": "s",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 3,
            "x": 0,
            "y": 19
          },
          "height": "55px",
          "id": 29,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "dsType": "prometheus",
              "expr": "max(sum(pg_stat_activity_max_tx_duration{job=\"$host\",datname=~\"$db\"}))",
              "format": "time_series",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "intervalFactor": 1,
              "legendFormat": "",
              "measurement": "postgresql",
              "policy": "default",
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "xact_commit"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  },
                  {
                    "params": [
                      "10s"
                    ],
                    "type": "non_negative_derivative"
                  }
                ]
              ],
              "step": 1800,
              "tags": [
                {
                  "key": "host",
                  "operator": "=~",
                  "value": "/^$host$/"
                }
              ]
            }
          ],
          "thresholds": "",
          "title": "Longest transactions",
          "transparent": true,
          "type": "singlestat",
          "valueFontSize": "150%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "fieldConfig": {
            "defaults": {
              "custom": {},
              "links": []
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 21,
            "x": 3,
            "y": 19
          },
          "hiddenSeries": false,
          "id": 28,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "hideEmpty": false,
            "hideZero": false,
            "max": true,
            "min": true,
            "rightSide": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.0-beta1",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum by (state) (pg_stat_activity_max_tx_duration{job=\"$host\",datname=~\"$db\"})",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "{{ state }}",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Transactions duration",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": true,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "s",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "collapsed": true,
          "datasource": null,
          "gridPos": {
            "h": 1,
            "w": 24,
            "x": 0,
            "y": 28
          },
          "id": 73,
          "panels": [
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 9,
                "w": 3,
                "x": 0,
                "y": 29
              },
              "id": 21,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "options": {},
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": true,
                "ymax": null,
                "ymin": null
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "sum(pg_stat_activity_count{datname=~\"$db\",job=\"$host\"})",
                  "format": "time_series",
                  "interval": "",
                  "intervalFactor": 1,
                  "legendFormat": "total",
                  "metric": "pg_runtime_variable_max_connections",
                  "refId": "A",
                  "step": 2
                }
              ],
              "thresholds": "",
              "timeFrom": null,
              "timeShift": null,
              "title": "Total connections",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "fill": 0,
              "fillGradient": 0,
              "gridPos": {
                "h": 9,
                "w": 10,
                "x": 3,
                "y": 29
              },
              "id": 22,
              "legend": {
                "alignAsTable": true,
                "avg": false,
                "current": true,
                "hideZero": false,
                "max": true,
                "min": false,
                "rightSide": true,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "null",
              "options": {
                "dataLinks": []
              },
              "percentage": false,
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "sum by (state) (pg_stat_activity_count{datname=~\"$db\",job=\"$host\"})",
                  "format": "time_series",
                  "hide": false,
                  "instant": false,
                  "intervalFactor": 1,
                  "legendFormat": "{{ state }}",
                  "metric": "pg",
                  "refId": "B",
                  "step": 2
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Connections",
              "tooltip": {
                "shared": true,
                "sort": 0,
                "value_type": "individual"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "decimals": 0,
              "fill": 0,
              "fillGradient": 0,
              "gridPos": {
                "h": 9,
                "w": 11,
                "x": 13,
                "y": 29
              },
              "id": 33,
              "legend": {
                "alignAsTable": true,
                "avg": true,
                "current": true,
                "max": true,
                "min": true,
                "rightSide": true,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "null",
              "options": {
                "dataLinks": []
              },
              "percentage": false,
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "sum by (mode) (pg_locks_count{job=\"$host\",datname=~\"$db\"})",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "legendFormat": "{{ mode }}",
                  "refId": "A"
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Locks",
              "tooltip": {
                "shared": true,
                "sort": 0,
                "value_type": "individual"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "decimals": 0,
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "editable": true,
              "error": false,
              "fill": 0,
              "fillGradient": 0,
              "grid": {},
              "gridPos": {
                "h": 9,
                "w": 12,
                "x": 0,
                "y": 38
              },
              "id": 1,
              "isNew": true,
              "legend": {
                "alignAsTable": true,
                "avg": true,
                "current": false,
                "max": true,
                "min": true,
                "rightSide": true,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "connected",
              "options": {
                "dataLinks": []
              },
              "percentage": false,
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "alias": "fetched",
                  "dsType": "prometheus",
                  "expr": "sum(irate(pg_stat_database_tup_fetched{datname=~\"$db\",job=~\"$host\"}[$interval]))",
                  "format": "time_series",
                  "groupBy": [
                    {
                      "params": [
                        "$interval"
                      ],
                      "type": "time"
                    },
                    {
                      "params": [
                        "null"
                      ],
                      "type": "fill"
                    }
                  ],
                  "hide": false,
                  "intervalFactor": 1,
                  "legendFormat": "select (fetched)",
                  "measurement": "postgresql",
                  "policy": "default",
                  "refId": "A",
                  "resultFormat": "time_series",
                  "select": [
                    [
                      {
                        "params": [
                          "tup_fetched"
                        ],
                        "type": "field"
                      },
                      {
                        "params": [],
                        "type": "mean"
                      },
                      {
                        "params": [
                          "10s"
                        ],
                        "type": "non_negative_derivative"
                      }
                    ]
                  ],
                  "step": 120,
                  "tags": [
                    {
                      "key": "host",
                      "operator": "=~",
                      "value": "/^$host$/"
                    }
                  ]
                },
                {
                  "alias": "fetched",
                  "dsType": "prometheus",
                  "expr": "sum(irate(pg_stat_database_tup_returned{datname=~\"$db\",job=~\"$host\"}[$interval]))",
                  "format": "time_series",
                  "groupBy": [
                    {
                      "params": [
                        "$interval"
                      ],
                      "type": "time"
                    },
                    {
                      "params": [
                        "null"
                      ],
                      "type": "fill"
                    }
                  ],
                  "hide": false,
                  "intervalFactor": 1,
                  "legendFormat": "select (returned)",
                  "measurement": "postgresql",
                  "policy": "default",
                  "refId": "B",
                  "resultFormat": "time_series",
                  "select": [
                    [
                      {
                        "params": [
                          "tup_fetched"
                        ],
                        "type": "field"
                      },
                      {
                        "params": [],
                        "type": "mean"
                      },
                      {
                        "params": [
                          "10s"
                        ],
                        "type": "non_negative_derivative"
                      }
                    ]
                  ],
                  "step": 120,
                  "tags": [
                    {
                      "key": "host",
                      "operator": "=~",
                      "value": "/^$host$/"
                    }
                  ]
                },
                {
                  "alias": "fetched",
                  "dsType": "prometheus",
                  "expr": "sum(irate(pg_stat_database_tup_inserted{datname=~\"$db\",job=~\"$host\"}[$interval]))",
                  "format": "time_series",
                  "groupBy": [
                    {
                      "params": [
                        "$interval"
                      ],
                      "type": "time"
                    },
                    {
                      "params": [
                        "null"
                      ],
                      "type": "fill"
                    }
                  ],
                  "intervalFactor": 1,
                  "legendFormat": "insert",
                  "measurement": "postgresql",
                  "policy": "default",
                  "refId": "C",
                  "resultFormat": "time_series",
                  "select": [
                    [
                      {
                        "params": [
                          "tup_fetched"
                        ],
                        "type": "field"
                      },
                      {
                        "params": [],
                        "type": "mean"
                      },
                      {
                        "params": [
                          "10s"
                        ],
                        "type": "non_negative_derivative"
                      }
                    ]
                  ],
                  "step": 120,
                  "tags": [
                    {
                      "key": "host",
                      "operator": "=~",
                      "value": "/^$host$/"
                    }
                  ]
                },
                {
                  "alias": "fetched",
                  "dsType": "prometheus",
                  "expr": "sum(irate(pg_stat_database_tup_updated{datname=~\"$db\",job=~\"$host\"}[$interval]))",
                  "format": "time_series",
                  "groupBy": [
                    {
                      "params": [
                        "$interval"
                      ],
                      "type": "time"
                    },
                    {
                      "params": [
                        "null"
                      ],
                      "type": "fill"
                    }
                  ],
                  "intervalFactor": 1,
                  "legendFormat": "update",
                  "measurement": "postgresql",
                  "policy": "default",
                  "refId": "D",
                  "resultFormat": "time_series",
                  "select": [
                    [
                      {
                        "params": [
                          "tup_fetched"
                        ],
                        "type": "field"
                      },
                      {
                        "params": [],
                        "type": "mean"
                      },
                      {
                        "params": [
                          "10s"
                        ],
                        "type": "non_negative_derivative"
                      }
                    ]
                  ],
                  "step": 120,
                  "tags": [
                    {
                      "key": "host",
                      "operator": "=~",
                      "value": "/^$host$/"
                    }
                  ]
                },
                {
                  "alias": "fetched",
                  "dsType": "prometheus",
                  "expr": "sum(irate(pg_stat_database_tup_deleted{datname=~\"$db\",job=~\"$host\"}[$interval]))",
                  "format": "time_series",
                  "groupBy": [
                    {
                      "params": [
                        "$interval"
                      ],
                      "type": "time"
                    },
                    {
                      "params": [
                        "null"
                      ],
                      "type": "fill"
                    }
                  ],
                  "intervalFactor": 1,
                  "legendFormat": "delete",
                  "measurement": "postgresql",
                  "policy": "default",
                  "refId": "E",
                  "resultFormat": "time_series",
                  "select": [
                    [
                      {
                        "params": [
                          "tup_fetched"
                        ],
                        "type": "field"
                      },
                      {
                        "params": [],
                        "type": "mean"
                      },
                      {
                        "params": [
                          "10s"
                        ],
                        "type": "non_negative_derivative"
                      }
                    ]
                  ],
                  "step": 120,
                  "tags": [
                    {
                      "key": "host",
                      "operator": "=~",
                      "value": "/^$host$/"
                    }
                  ]
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Rows",
              "tooltip": {
                "msResolution": true,
                "shared": true,
                "sort": 0,
                "value_type": "cumulative"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "editable": true,
              "error": false,
              "fill": 1,
              "fillGradient": 4,
              "grid": {},
              "gridPos": {
                "h": 9,
                "w": 12,
                "x": 12,
                "y": 38
              },
              "id": 12,
              "isNew": true,
              "legend": {
                "alignAsTable": true,
                "avg": true,
                "current": true,
                "max": true,
                "min": true,
                "rightSide": false,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "connected",
              "options": {
                "dataLinks": []
              },
              "percentage": true,
              "pointradius": 1,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "sum(pg_stat_database_blks_hit{datname=~\"$db\",job=\"$host\"}) / (sum(pg_stat_database_blks_hit{datname=~\"$db\",job=\"$host\"}) + sum(pg_stat_database_blks_read{datname=~\"$db\",job=\"$host\"}))",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "legendFormat": "cache hit rate",
                  "refId": "A",
                  "step": 240
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Cache hit ratio",
              "tooltip": {
                "msResolution": false,
                "shared": true,
                "sort": 0,
                "value_type": "cumulative"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "percentunit",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "editable": true,
              "error": false,
              "fill": 0,
              "fillGradient": 0,
              "grid": {},
              "gridPos": {
                "h": 9,
                "w": 12,
                "x": 0,
                "y": 47
              },
              "id": 3,
              "isNew": true,
              "legend": {
                "alignAsTable": true,
                "avg": true,
                "current": true,
                "max": true,
                "min": true,
                "rightSide": false,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "connected",
              "options": {
                "dataLinks": []
              },
              "percentage": false,
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "alias": "conflicts",
                  "dsType": "prometheus",
                  "expr": "sum(rate(pg_stat_database_deadlocks{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "format": "time_series",
                  "groupBy": [
                    {
                      "params": [
                        "$interval"
                      ],
                      "type": "time"
                    },
                    {
                      "params": [
                        "null"
                      ],
                      "type": "fill"
                    }
                  ],
                  "intervalFactor": 1,
                  "legendFormat": "deadlocks",
                  "measurement": "postgresql",
                  "policy": "default",
                  "refId": "A",
                  "resultFormat": "time_series",
                  "select": [
                    [
                      {
                        "params": [
                          "conflicts"
                        ],
                        "type": "field"
                      },
                      {
                        "params": [],
                        "type": "mean"
                      },
                      {
                        "params": [],
                        "type": "difference"
                      }
                    ]
                  ],
                  "step": 240,
                  "tags": [
                    {
                      "key": "host",
                      "operator": "=~",
                      "value": "/^$host$/"
                    }
                  ]
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Deadlocks",
              "tooltip": {
                "msResolution": false,
                "shared": true,
                "sort": 0,
                "value_type": "cumulative"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": 0,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "description": "",
              "fill": 0,
              "fillGradient": 0,
              "gridPos": {
                "h": 9,
                "w": 12,
                "x": 12,
                "y": 47
              },
              "id": 24,
              "legend": {
                "alignAsTable": true,
                "avg": true,
                "current": true,
                "max": true,
                "min": true,
                "rightSide": true,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "null",
              "options": {
                "dataLinks": []
              },
              "percentage": false,
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "sum(rate(pg_stat_database_conflicts{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "legendFormat": "conflicts",
                  "refId": "F"
                },
                {
                  "expr": "sum(rate(pg_stat_database_conflicts_confl_bufferpin{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "intervalFactor": 2,
                  "legendFormat": "bufferpin",
                  "metric": "pg_stat_database_conflicts_confl_bufferpin",
                  "refId": "A",
                  "step": 2
                },
                {
                  "expr": "sum(rate(pg_stat_database_conflicts_confl_deadlock{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "intervalFactor": 2,
                  "legendFormat": "deadlock",
                  "metric": "pg_stat_database_conflicts_confl_bufferpin",
                  "refId": "B",
                  "step": 2
                },
                {
                  "expr": "sum(rate(pg_stat_database_conflicts_confl_lock{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "intervalFactor": 2,
                  "legendFormat": "lock",
                  "metric": "pg_stat_database_conflicts_confl_bufferpin",
                  "refId": "C",
                  "step": 2
                },
                {
                  "expr": "sum(rate(pg_stat_database_conflicts_confl_snapshot{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "intervalFactor": 2,
                  "legendFormat": "snapshot",
                  "metric": "pg_stat_database_conflicts_confl_bufferpin",
                  "refId": "D",
                  "step": 2
                },
                {
                  "expr": "sum(rate(pg_stat_database_conflicts_confl_tablespace{datname=~\"$db\",job=\"$host\"}[$interval]))",
                  "intervalFactor": 2,
                  "legendFormat": "tablespace",
                  "metric": "pg_stat_database_conflicts_confl_bufferpin",
                  "refId": "E",
                  "step": 2
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Conflicts",
              "tooltip": {
                "shared": true,
                "sort": 0,
                "value_type": "individual"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            }
          ],
          "title": "Transactions",
          "type": "row"
        },
        {
          "collapsed": true,
          "datasource": null,
          "gridPos": {
            "h": 1,
            "w": 24,
            "x": 0,
            "y": 29
          },
          "id": 35,
          "panels": [
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "description": "",
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 5,
                "w": 2,
                "x": 0,
                "y": 30
              },
              "id": 47,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_seq_page_cost{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Sequential page cost",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "description": "Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.",
              "fieldConfig": {
                "defaults": {
                  "custom": {},
                  "links": []
                },
                "overrides": []
              },
              "fill": 1,
              "fillGradient": 4,
              "gridPos": {
                "h": 10,
                "w": 22,
                "x": 2,
                "y": 30
              },
              "hiddenSeries": false,
              "id": 37,
              "legend": {
                "alignAsTable": true,
                "avg": true,
                "current": true,
                "max": true,
                "min": true,
                "show": true,
                "total": false,
                "values": true
              },
              "lines": true,
              "linewidth": 2,
              "links": [],
              "nullPointMode": "null",
              "options": {
                "alertThreshold": true
              },
              "percentage": false,
              "pluginVersion": "7.4.0-beta1",
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "irate(pg_stat_database_temp_bytes{job=\"$host\",datname=~\"$db\",datname!~\"template.*|postgres\"}[$interval])",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "legendFormat": "Temp bytes",
                  "refId": "A"
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Temp bytes",
              "tooltip": {
                "shared": true,
                "sort": 0,
                "value_type": "individual"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "bytes",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 5,
                "w": 2,
                "x": 0,
                "y": 35
              },
              "id": 49,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_random_page_cost{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Random page cost",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            }
          ],
          "title": "Others",
          "type": "row"
        },
        {
          "collapsed": true,
          "datasource": null,
          "gridPos": {
            "h": 1,
            "w": 24,
            "x": 0,
            "y": 30
          },
          "id": 43,
          "panels": [
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 0,
                "y": 31
              },
              "id": 44,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_server_version_num{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Version",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 3,
                "y": 31
              },
              "id": 41,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_max_connections{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Max connections",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "decimals": 1,
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "bytes",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 6,
                "y": 31
              },
              "id": 55,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_max_wal_size_bytes{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Max WAL size",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "decimals": 1,
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "bytes",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 9,
                "y": 31
              },
              "id": 51,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_work_mem_bytes{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "legendFormat": "",
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Work memory",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "decimals": 1,
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "bytes",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 12,
                "y": 31
              },
              "id": 53,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_maintenance_work_mem_bytes{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Maintenance work mem",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "decimals": 1,
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "bytes",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 0,
                "y": 35
              },
              "id": 57,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_shared_buffers_bytes{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Shared buffers",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "decimals": 1,
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "bytes",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 3,
                "y": 35
              },
              "id": 59,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_effective_cache_size_bytes{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Effective cache",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 6,
                "y": 35
              },
              "id": 61,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_max_worker_processes{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Max worker processes",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "#299c46",
                "rgba(237, 129, 40, 0.89)",
                "#d44a3a"
              ],
              "datasource": "prometheus",
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 4,
                "w": 3,
                "x": 9,
                "y": 35
              },
              "id": 63,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "pg_settings_max_parallel_workers{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "refId": "A"
                }
              ],
              "thresholds": "",
              "title": "Max parallel workers",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            }
          ],
          "title": "Settings",
          "type": "row"
        },
        {
          "collapsed": true,
          "datasource": null,
          "gridPos": {
            "h": 1,
            "w": 24,
            "x": 0,
            "y": 31
          },
          "id": 17,
          "panels": [
            {
              "cacheTimeout": null,
              "colorBackground": false,
              "colorValue": false,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "datasource": "prometheus",
              "decimals": null,
              "format": "none",
              "gauge": {
                "maxValue": 100,
                "minValue": 0,
                "show": false,
                "thresholdLabels": false,
                "thresholdMarkers": true
              },
              "gridPos": {
                "h": 9,
                "w": 4,
                "x": 0,
                "y": 3
              },
              "id": 39,
              "interval": null,
              "links": [],
              "mappingType": 1,
              "mappingTypes": [
                {
                  "name": "value to text",
                  "value": 1
                },
                {
                  "name": "range to text",
                  "value": 2
                }
              ],
              "maxDataPoints": 100,
              "nullPointMode": "connected",
              "nullText": null,
              "options": {},
              "postfix": "",
              "postfixFontSize": "50%",
              "prefix": "",
              "prefixFontSize": "50%",
              "rangeMaps": [
                {
                  "from": "null",
                  "text": "N/A",
                  "to": "null"
                }
              ],
              "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)",
                "full": false,
                "lineColor": "rgb(31, 120, 193)",
                "show": false
              },
              "tableColumn": "",
              "targets": [
                {
                  "expr": "up{job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "legendFormat": "",
                  "refId": "A",
                  "step": 1800
                }
              ],
              "thresholds": "",
              "title": "Replica",
              "transparent": true,
              "type": "singlestat",
              "valueFontSize": "150%",
              "valueMaps": [
                {
                  "op": "=",
                  "text": "N/A",
                  "value": "null"
                }
              ],
              "valueName": "current"
            },
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": "prometheus",
              "fill": 1,
              "fillGradient": 0,
              "gridPos": {
                "h": 10,
                "w": 12,
                "x": 4,
                "y": 3
              },
              "id": 15,
              "legend": {
                "avg": false,
                "current": false,
                "max": false,
                "min": false,
                "show": true,
                "total": false,
                "values": false
              },
              "lines": true,
              "linewidth": 1,
              "links": [],
              "nullPointMode": "null",
              "options": {
                "dataLinks": []
              },
              "percentage": false,
              "pointradius": 5,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "pg_replication_lag{datname=~\"$db\",job=\"$host\"}",
                  "format": "time_series",
                  "intervalFactor": 1,
                  "metric": "pg_replication_lag",
                  "refId": "A",
                  "step": 2
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Replication Lag",
              "tooltip": {
                "shared": true,
                "sort": 0,
                "value_type": "individual"
              },
              "transparent": true,
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "s",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": false
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            }
          ],
          "title": "Replication",
          "type": "row"
        }
      ],
      "refresh": "30s",
      "schemaVersion": 27,
      "style": "dark",
      "tags": [
        "databases",
        "postgresql"
      ],
      "templating": {
        "list": [
          {
            "allValue": ".*",
            "current": {
              "selected": false,
              "text": "postgresql",
              "value": "postgresql"
            },
            "datasource": "prometheus",
            "definition": "label_values(pg_up,job)",
            "description": null,
            "error": null,
            "hide": 0,
            "includeAll": false,
            "label": "Host:",
            "multi": false,
            "name": "host",
            "options": [],
            "query": {
              "query": "label_values(pg_up,job)",
              "refId": "StandardVariableQuery"
            },
            "refresh": 1,
            "regex": "",
            "skipUrlSync": false,
            "sort": 0,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          },
          {
            "allValue": ".*",
            "current": {
              "selected": false,
              "text": "All",
              "value": "$__all"
            },
            "datasource": "prometheus",
            "definition": "label_values(pg_stat_database_tup_fetched{job=~\"$host\",datname!~\"template.*|postgres\"},datname)",
            "description": null,
            "error": null,
            "hide": 0,
            "includeAll": true,
            "label": "DB:",
            "multi": false,
            "name": "db",
            "options": [],
            "query": {
              "query": "label_values(pg_stat_database_tup_fetched{job=~\"$host\",datname!~\"template.*|postgres\"},datname)",
              "refId": "prometheus-db-Variable-Query"
            },
            "refresh": 1,
            "regex": "",
            "skipUrlSync": false,
            "sort": 0,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          },
          {
            "auto": false,
            "auto_count": 30,
            "auto_min": "1m",
            "current": {
              "selected": false,
              "text": "1m",
              "value": "1m"
            },
            "description": null,
            "error": null,
            "hide": 0,
            "label": "Interval:",
            "name": "interval",
            "options": [
              {
                "selected": true,
                "text": "1m",
                "value": "1m"
              },
              {
                "selected": false,
                "text": "5m",
                "value": "5m"
              },
              {
                "selected": false,
                "text": "10m",
                "value": "10m"
              },
              {
                "selected": false,
                "text": "30m",
                "value": "30m"
              },
              {
                "selected": false,
                "text": "1h",
                "value": "1h"
              },
              {
                "selected": false,
                "text": "6h",
                "value": "6h"
              },
              {
                "selected": false,
                "text": "12h",
                "value": "12h"
              },
              {
                "selected": false,
                "text": "1d",
                "value": "1d"
              },
              {
                "selected": false,
                "text": "7d",
                "value": "7d"
              },
              {
                "selected": false,
                "text": "14d",
                "value": "14d"
              },
              {
                "selected": false,
                "text": "30d",
                "value": "30d"
              }
            ],
            "query": "1m,5m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
            "refresh": 2,
            "skipUrlSync": false,
            "type": "interval"
          }
        ]
      },
      "time": {
        "from": "now-10m",
        "to": "now"
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      },
      "timezone": "browser",
      "title": "PostgreSQL",
      "uid": "postgresql",
      "version": 2
    }