apiVersion: v1
data:
  pgbackrest.json: |-
   {
     "__inputs": [
       {
         "name": "DS_PROMETHEUS",
         "label": "PROMETHEUS",
         "description": "",
         "type": "datasource",
         "pluginId": "prometheus",
         "pluginName": "Prometheus"
       }
     ],
     "__requires": [
       {
         "type": "grafana",
         "id": "grafana",
         "name": "Grafana",
         "version": "7.4.5"
       },
       {
         "type": "panel",
         "id": "graph",
         "name": "Graph",
         "version": ""
       },
       {
         "type": "datasource",
         "id": "prometheus",
         "name": "Prometheus",
         "version": "1.0.0"
       },
       {
         "type": "panel",
         "id": "stat",
         "name": "Stat",
         "version": ""
       }
     ],
     "annotations": {
       "list": [
         {
           "builtIn": 1,
           "datasource": "-- Grafana --",
           "enable": true,
           "hide": true,
           "iconColor": "rgba(0, 211, 255, 1)",
           "name": "Annotations & Alerts",
           "type": "dashboard"
         }
       ]
     },
     "editable": false,
     "gnetId": null,
     "graphTooltip": 0,
     "id": null,
     "iteration": 1625069660860,
     "links": [
       {
         "asDropdown": false,
         "icon": "external link",
         "includeVars": true,
         "keepTime": true,
         "tags": [
           "vendor=crunchydata"
         ],
         "title": "",
         "type": "dashboards"
       }
     ],
     "panels": [
       {
         "datasource": "Prometheus",
         "fieldConfig": {
           "defaults": {
             "color": {
               "mode": "thresholds"
             },
             "custom": {},
             "mappings": [],
             "thresholds": {
               "mode": "absolute",
               "steps": [
                 {
                   "color": "semi-dark-blue",
                   "value": null
                 }
               ]
             },
             "unit": "dtdhms"
           },
           "overrides": []
         },
         "gridPos": {
           "h": 3,
           "w": 24,
           "x": 0,
           "y": 0
         },
         "id": 8,
         "options": {
           "colorMode": "background",
           "graphMode": "area",
           "justifyMode": "auto",
           "orientation": "auto",
           "reduceOptions": {
             "calcs": [
               "last"
             ],
             "fields": "/^Value$/",
             "values": false
           },
           "text": {
             "valueSize": 45
           },
           "textMode": "auto"
         },
         "pluginVersion": "7.4.5",
         "targets": [
           {
             "expr": "time()-ccp_backrest_oldest_full_backup_time_seconds{pg_cluster=\"[[cluster]]\", role=\"master\"}",
             "format": "table",
             "instant": true,
             "interval": "",
             "legendFormat": "Recovery window",
             "refId": "A"
           }
         ],
         "title": "Recovery Window",
         "type": "stat"
       },
       {
         "aliasColors": {
           "Differential": "dark-blue",
           "Differential Backup": "dark-blue",
           "Full": "dark-green",
           "Full Backup": "dark-green",
           "Incremental": "light-blue",
           "Incremental Backup": "light-blue"
         },
         "bars": false,
         "dashLength": 10,
         "dashes": false,
         "datasource": "Prometheus",
         "fieldConfig": {
           "defaults": {
             "custom": {},
             "links": []
           },
           "overrides": []
         },
         "fill": 1,
         "fillGradient": 0,
         "gridPos": {
           "h": 7,
           "w": 12,
           "x": 0,
           "y": 3
         },
         "hiddenSeries": false,
         "id": 2,
         "legend": {
           "alignAsTable": true,
           "avg": false,
           "current": false,
           "max": false,
           "min": false,
           "rightSide": true,
           "show": true,
           "sideWidth": 150,
           "total": false,
           "values": false
         },
         "lines": true,
         "linewidth": 1,
         "links": [],
         "nullPointMode": "null",
         "options": {
           "alertThreshold": false
         },
         "percentage": false,
         "pluginVersion": "7.4.5",
         "pointradius": 5,
         "points": false,
         "renderer": "flot",
         "seriesOverrides": [],
         "spaceLength": 10,
         "stack": false,
         "steppedLine": false,
         "targets": [
           {
             "expr": "min(ccp_backrest_last_incr_backup_time_since_completion_seconds{pg_cluster=\"[[cluster]]\", role=\"master\"}) without(deployment,instance,ip,pod)",
             "format": "time_series",
             "instant": false,
             "interval": "",
             "intervalFactor": 1,
             "legendFormat": "Incremental Backup",
             "refId": "A"
           },
           {
             "expr": "min(ccp_backrest_last_diff_backup_time_since_completion_seconds{pg_cluster=\"[[cluster]]\", role=\"master\"}) without(deployment, instance,ip,pod)",
             "hide": false,
             "interval": "",
             "legendFormat": "Differential Backup",
             "refId": "B"
           },
           {
             "expr": "min(ccp_backrest_last_full_backup_time_since_completion_seconds{pg_cluster=\"[[cluster]]\", role=\"master\"}) without(deployment, instance,ip,pod)",
             "hide": false,
             "interval": "",
             "legendFormat": "Full Backup",
             "refId": "C"
           },
           {
             "expr": "min(ccp_archive_command_status_seconds_since_last_archive{pg_cluster=\"[[cluster]]\", role=\"master\"}) without(deployment, instance,ip,pod)",
             "hide": false,
             "interval": "",
             "legendFormat": "WAL Archive",
             "refId": "D"
           }
         ],
         "thresholds": [],
         "timeFrom": null,
         "timeRegions": [],
         "timeShift": null,
         "title": "Time Since",
         "tooltip": {
           "shared": true,
           "sort": 0,
           "value_type": "individual"
         },
         "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": {
           "Differential": "dark-blue",
           "Full": "dark-green",
           "Incremental": "light-blue"
         },
         "bars": false,
         "dashLength": 10,
         "dashes": false,
         "datasource": "Prometheus",
         "fieldConfig": {
           "defaults": {
             "custom": {},
             "links": []
           },
           "overrides": []
         },
         "fill": 1,
         "fillGradient": 0,
         "gridPos": {
           "h": 7,
           "w": 12,
           "x": 12,
           "y": 3
         },
         "hiddenSeries": false,
         "id": 4,
         "legend": {
           "alignAsTable": true,
           "avg": false,
           "current": false,
           "hideEmpty": false,
           "hideZero": false,
           "max": false,
           "min": false,
           "rightSide": true,
           "show": true,
           "sideWidth": 150,
           "total": false,
           "values": false
         },
         "lines": true,
         "linewidth": 1,
         "links": [],
         "nullPointMode": "null",
         "options": {
           "alertThreshold": true
         },
         "percentage": false,
         "pluginVersion": "7.4.5",
         "pointradius": 5,
         "points": false,
         "renderer": "flot",
         "seriesOverrides": [],
         "spaceLength": 10,
         "stack": false,
         "steppedLine": false,
         "targets": [
           {
             "expr": "min(ccp_backrest_last_info_backup_runtime_seconds{pg_cluster=\"[[cluster]]\", role=\"master\", backup_type=\"incr\"}) without (deployment,instance,pod,ip)",
             "format": "time_series",
             "instant": false,
             "interval": "",
             "intervalFactor": 1,
             "legendFormat": "Incremental",
             "refId": "A"
           },
           {
             "expr": "min(ccp_backrest_last_info_backup_runtime_seconds{pg_cluster=\"[[cluster]]\", role=\"master\", backup_type=\"diff\"}) without (deployment,instance,pod,ip)",
             "hide": false,
             "interval": "",
             "legendFormat": "Differential",
             "refId": "B"
           },
           {
             "expr": "min(ccp_backrest_last_info_backup_runtime_seconds{pg_cluster=\"[[cluster]]\", role=\"master\", backup_type=\"full\"}) without (deployment,instance,pod,ip)",
             "hide": false,
             "interval": "",
             "legendFormat": "Full",
             "refId": "C"
           }
         ],
         "thresholds": [],
         "timeFrom": null,
         "timeRegions": [],
         "timeShift": null,
         "title": "Backup Runtimes",
         "tooltip": {
           "shared": true,
           "sort": 0,
           "value_type": "individual"
         },
         "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": 2,
             "max": null,
             "min": null,
             "show": false
           }
         ],
         "yaxis": {
           "align": false,
           "alignLevel": null
         }
       },
       {
         "aliasColors": {
           "Differential": "dark-blue",
           "Full": "dark-green",
           "Incremental": "light-blue"
         },
         "bars": false,
         "dashLength": 10,
         "dashes": false,
         "datasource": "Prometheus",
         "description": "",
         "fieldConfig": {
           "defaults": {
             "custom": {},
             "links": []
           },
           "overrides": []
         },
         "fill": 1,
         "fillGradient": 0,
         "gridPos": {
           "h": 7,
           "w": 12,
           "x": 0,
           "y": 10
         },
         "hiddenSeries": false,
         "id": 5,
         "legend": {
           "alignAsTable": true,
           "avg": false,
           "current": false,
           "hideEmpty": false,
           "hideZero": false,
           "max": false,
           "min": false,
           "rightSide": true,
           "show": true,
           "sideWidth": 150,
           "total": false,
           "values": false
         },
         "lines": true,
         "linewidth": 1,
         "links": [],
         "nullPointMode": "null",
         "options": {
           "alertThreshold": true
         },
         "percentage": false,
         "pluginVersion": "7.4.5",
         "pointradius": 5,
         "points": false,
         "renderer": "flot",
         "seriesOverrides": [],
         "spaceLength": 10,
         "stack": false,
         "steppedLine": false,
         "targets": [
           {
             "expr": "min(ccp_backrest_last_info_repo_backup_size_bytes{pg_cluster=\"[[cluster]]\", role=\"master\", backup_type=\"incr\"}) without (deployment, instance,pod,ip)",
             "format": "time_series",
             "instant": false,
             "interval": "",
             "intervalFactor": 1,
             "legendFormat": "Incremental",
             "refId": "A"
           },
           {
             "expr": "min(ccp_backrest_last_info_repo_backup_size_bytes{pg_cluster=\"[[cluster]]\", role=\"master\", backup_type=\"diff\"}) without (deployment,instance,pod,ip)",
             "hide": false,
             "interval": "",
             "legendFormat": "Differential",
             "refId": "B"
           },
           {
             "expr": "min(ccp_backrest_last_info_repo_backup_size_bytes{pg_cluster=\"[[cluster]]\", role=\"master\", backup_type=\"full\"}) without (deployment,instance,pod,ip)",
             "hide": false,
             "interval": "",
             "legendFormat": "Full",
             "refId": "C"
           }
         ],
         "thresholds": [],
         "timeFrom": null,
         "timeRegions": [],
         "timeShift": null,
         "title": "Backup Size",
         "tooltip": {
           "shared": true,
           "sort": 0,
           "value_type": "individual"
         },
         "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": 2,
             "max": null,
             "min": null,
             "show": false
           }
         ],
         "yaxis": {
           "align": false,
           "alignLevel": null
         }
       },
       {
         "aliasColors": {
           "Archive age": "blue",
           "Archive count": "green",
           "Differential": "dark-blue",
           "Failed count": "red",
           "Full": "dark-green",
           "Incremental": "light-blue"
         },
         "bars": false,
         "dashLength": 10,
         "dashes": false,
         "datasource": "Prometheus",
         "description": "",
         "fieldConfig": {
           "defaults": {
             "custom": {},
             "links": []
           },
           "overrides": []
         },
         "fill": 3,
         "fillGradient": 0,
         "gridPos": {
           "h": 7,
           "w": 12,
           "x": 12,
           "y": 10
         },
         "hiddenSeries": false,
         "id": 6,
         "legend": {
           "alignAsTable": true,
           "avg": false,
           "current": false,
           "hideEmpty": false,
           "hideZero": false,
           "max": false,
           "min": false,
           "rightSide": true,
           "show": true,
           "sideWidth": 150,
           "total": false,
           "values": false
         },
         "lines": true,
         "linewidth": 1,
         "links": [],
         "nullPointMode": "null",
         "options": {
           "alertThreshold": true
         },
         "percentage": false,
         "pluginVersion": "7.4.5",
         "pointradius": 5,
         "points": false,
         "renderer": "flot",
         "seriesOverrides": [],
         "spaceLength": 10,
         "stack": false,
         "steppedLine": false,
         "targets": [
           {
             "expr": "avg(idelta(ccp_archive_command_status_failed_count{pg_cluster=\"[[cluster]]\", role=\"master\"}[1m])) without (instance,ip)",
             "format": "time_series",
             "instant": false,
             "interval": "",
             "intervalFactor": 1,
             "legendFormat": "Failed count",
             "refId": "A"
           },
           {
             "expr": "avg(idelta(ccp_archive_command_status_archived_count{pg_cluster=\"[[cluster]]\", role=\"master\"}[1m])) without (instance,pod, ip)",
             "hide": false,
             "interval": "",
             "legendFormat": "Archive count",
             "refId": "B"
           }
         ],
         "thresholds": [],
         "timeFrom": null,
         "timeRegions": [],
         "timeShift": null,
         "title": "WAL Stats",
         "tooltip": {
           "shared": true,
           "sort": 0,
           "value_type": "individual"
         },
         "type": "graph",
         "xaxis": {
           "buckets": null,
           "mode": "time",
           "name": null,
           "show": true,
           "values": []
         },
         "yaxes": [
           {
             "format": "short",
             "label": "",
             "logBase": 1,
             "max": null,
             "min": "0",
             "show": true
           },
           {
             "format": "short",
             "label": null,
             "logBase": 1,
             "max": null,
             "min": "0",
             "show": false
           }
         ],
         "yaxis": {
           "align": false,
           "alignLevel": null
         }
       }
     ],
     "refresh": "5m",
     "schemaVersion": 27,
     "style": "dark",
     "tags": [
       "vendor=crunchydata"
     ],
     "templating": {
       "list": [
         {
           "allValue": null,
           "current": {},
           "datasource": "Prometheus",
           "definition": "label_values(pg_cluster)",
           "description": null,
           "error": null,
           "hide": 0,
           "includeAll": false,
           "label": "cluster",
           "multi": false,
           "name": "cluster",
           "options": [],
           "query": {
             "query": "label_values(pg_cluster)",
             "refId": "PROMETHEUS-cluster-Variable-Query"
           },
           "refresh": 1,
           "regex": "",
           "skipUrlSync": false,
           "sort": 1,
           "tagValuesQuery": "",
           "tags": [],
           "tagsQuery": "",
           "type": "query",
           "useTags": false
         }
       ]
     },
     "time": {
       "from": "now-2w",
       "to": "now"
     },
     "timepicker": {
       "time_options": [
         "5m",
         "15m",
         "1h",
         "6h",
         "12h",
         "24h",
         "2d",
         "7d",
         "30d"
       ]
     },
     "timezone": "browser",
     "title": "pgBackRest",
     "uid": "2fcFZ6PGk",
     "version": 1
   }
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: grafana-dashboard-crunchy-pgbackrest
