{
  "uid": "pbs-backups",
  "title": "Backups (Proxmox Backup Server)",
  "tags": [
    "pbs",
    "backup",
    "proxmox"
  ],
  "timezone": "browser",
  "editable": true,
  "graphTooltip": 1,
  "refresh": "5m",
  "time": {
    "from": "now-7d",
    "to": "now"
  },
  "schemaVersion": 39,
  "version": 1,
  "links": [
    {
      "title": "All dashboards",
      "type": "dashboards",
      "asDropdown": true,
      "includeVars": false,
      "keepTime": true,
      "tags": [],
      "targetBlank": false,
      "icon": "external link"
    }
  ],
  "templating": {
    "list": []
  },
  "annotations": {
    "list": []
  },
  "panels": [
    {
      "id": 1,
      "type": "row",
      "title": "💾 Backup status",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 0,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 2,
      "type": "stat",
      "title": "PBS",
      "description": "Proxmox Backup Server answers the API.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 1,
        "w": 4,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_up",
          "legendFormat": "PBS",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "Offline",
                  "color": "red"
                },
                "1": {
                  "text": "Online",
                  "color": "green"
                }
              }
            }
          ]
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Guests with a fresh backup",
      "description": "Backed-up guests whose last backup is younger than 30 hours, out of all backed-up guests that still exist.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 4,
        "y": 1,
        "w": 5,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "count(((time() - pbs_snapshot_vm_last_timestamp) / 3600 and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))) < 30) or vector(0)",
          "legendFormat": "Fresh",
          "refId": "A",
          "range": false,
          "instant": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "count(((time() - pbs_snapshot_vm_last_timestamp) / 3600 and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\")))) or vector(0)",
          "legendFormat": "Total",
          "refId": "B",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": []
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value_and_name",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 4,
      "type": "stat",
      "title": "Overdue backups",
      "description": "Guests whose newest backup is older than 30 hours: a backup failed or was skipped. Alert after 10 minutes.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 9,
        "y": 1,
        "w": 4,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "count(((time() - pbs_snapshot_vm_last_timestamp) / 3600 and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))) >= 30) or vector(0)",
          "legendFormat": "Overdue",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "None",
                  "color": "green"
                }
              }
            }
          ]
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 5,
      "type": "stat",
      "title": "Oldest last backup",
      "description": "Age of the least recent 'last backup' across all guests.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 13,
        "y": 1,
        "w": 4,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "max(((time() - pbs_snapshot_vm_last_timestamp) / 3600 and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\")))) * 3600",
          "legendFormat": "Oldest",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 93600
              },
              {
                "color": "red",
                "value": 108000
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 6,
      "type": "stat",
      "title": "Datastore used",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 17,
        "y": 1,
        "w": 4,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "100 * pbs_used / pbs_size",
          "legendFormat": "{{datastore}}",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 70
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 1
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 7,
      "type": "stat",
      "title": "Backups stored",
      "description": "All backup snapshots in the datastore (after pruning: keep 3 last, 7 daily, 4 weekly, 6 monthly).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 21,
        "y": 1,
        "w": 3,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum(pbs_snapshot_count)",
          "legendFormat": "Snapshots",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": []
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 8,
      "type": "row",
      "title": "🗂️ Last backup per guest",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 6,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 9,
      "type": "table",
      "title": "Last backup per guest",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 7,
        "w": 16,
        "h": 14
      },
      "description": "One row per guest that still exists. Red = older than 30 h. 'Not yet' under Verified is normal until your verify job has run.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "(pbs_snapshot_vm_last_timestamp and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))) * 1000",
          "legendFormat": "",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "((time() - pbs_snapshot_vm_last_timestamp) / 3600 and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\")))",
          "legendFormat": "",
          "refId": "B",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_snapshot_vm_count and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))",
          "legendFormat": "",
          "refId": "C",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_snapshot_vm_last_verify and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))",
          "legendFormat": "",
          "refId": "D",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "__name__": true,
              "datastore": true,
              "namespace": true,
              "instance": true,
              "job": true,
              "host": true
            },
            "indexByName": {
              "vm_name": 0,
              "vm_id": 1,
              "Value #A": 2,
              "Value #B": 3,
              "Value #C": 4,
              "Value #D": 5
            },
            "renameByName": {
              "vm_name": "Guest",
              "vm_id": "ID",
              "Value #A": "Last backup",
              "Value #B": "Age",
              "Value #C": "Backups kept",
              "Value #D": "Verified"
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "sort": [
              {
                "field": "Age",
                "desc": true
              }
            ]
          }
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last backup"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Age"
            },
            "properties": [
              {
                "id": "unit",
                "value": "h"
              },
              {
                "id": "decimals",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 26
                    },
                    {
                      "color": "red",
                      "value": 30
                    }
                  ]
                }
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-background",
                  "mode": "basic"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Verified"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "type": "value",
                    "options": {
                      "0": {
                        "text": "Not yet",
                        "color": "text"
                      },
                      "1": {
                        "text": "✓ OK",
                        "color": "green"
                      }
                    }
                  }
                ]
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "footer": {
          "show": false
        }
      }
    },
    {
      "id": 10,
      "type": "table",
      "title": "Guests without any backup",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 16,
        "y": 7,
        "w": 8,
        "h": 7
      },
      "description": "Existing guests with no backup in PBS. A PBS VM usually excludes itself from the backup job; that one is expected here.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "max by (vm_id, name, node) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\")) unless on(vm_id) pbs_snapshot_vm_last_timestamp",
          "legendFormat": "",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Value": true
            },
            "indexByName": {
              "name": 0,
              "vm_id": 1,
              "node": 2
            },
            "renameByName": {
              "name": "Guest",
              "vm_id": "ID",
              "node": "Host"
            }
          }
        }
      ],
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      }
    },
    {
      "id": 11,
      "type": "table",
      "title": "Backups of deleted guests",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 16,
        "y": 14,
        "w": 8,
        "h": 7
      },
      "description": "Backups still kept in PBS for guests that no longer exist. Delete them in PBS (Datastore → Content) if you don't need them; they are not alerted on.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_snapshot_vm_count unless on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))",
          "legendFormat": "",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_snapshot_vm_last_timestamp * 1000 unless on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\"))",
          "legendFormat": "",
          "refId": "B",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "__name__": true,
              "datastore": true,
              "namespace": true,
              "instance": true,
              "job": true,
              "host": true
            },
            "indexByName": {
              "vm_name": 0,
              "vm_id": 1,
              "Value #A": 2,
              "Value #B": 3
            },
            "renameByName": {
              "vm_name": "Guest",
              "vm_id": "ID",
              "Value #A": "Backups",
              "Value #B": "Last backup"
            }
          }
        }
      ],
      "fieldConfig": {
        "defaults": {},
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last backup"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      }
    },
    {
      "id": 12,
      "type": "timeseries",
      "title": "Backup age per guest (hours)",
      "description": "Each line climbs during the day and drops to ~0 when the guest is backed up. A line that keeps climbing past the dashed 30 h line is a missed backup.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 21,
        "w": 24,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "((time() - pbs_snapshot_vm_last_timestamp) / 3600 and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\")))",
          "legendFormat": "{{vm_name}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "h",
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 2,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "transparent",
                "value": null
              },
              {
                "color": "red",
                "value": 30
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "calcs": [
            "lastNotNull",
            "max"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 13,
      "type": "row",
      "title": "🗄️ Datastore",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 29,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 14,
      "type": "timeseries",
      "title": "Datastore usage",
      "description": "Usage grows with each backup and drops after prune and garbage collection.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 30,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_used",
          "legendFormat": "Used",
          "refId": "A",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_size",
          "legendFormat": "Size",
          "refId": "B",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 2,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "calcs": [
            "lastNotNull",
            "min",
            "max"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 15,
      "type": "stat",
      "title": "Free",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 30,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_available",
          "legendFormat": "{{datastore}}",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 1
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 16,
      "type": "stat",
      "title": "Days until 80 % full",
      "description": "Linear forecast from the last 7 days of growth. Needs a few days of data.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 16,
        "y": 30,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "clamp_min((0.8 * pbs_size - pbs_used) / (deriv(pbs_used[7d]) > 0) / 86400, 0) or (pbs_size * 0 + 9999)",
          "legendFormat": "Days",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "d",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "orange",
                "value": 31
              },
              {
                "color": "green",
                "value": 90
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "range",
              "options": {
                "from": 3650,
                "to": 1000000000.0,
                "result": {
                  "text": "Not growing",
                  "color": "green"
                }
              }
            }
          ],
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 17,
      "type": "stat",
      "title": "Datastore size",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 20,
        "y": 30,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_size",
          "legendFormat": "{{datastore}}",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 1
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 18,
      "type": "bargauge",
      "title": "Backups kept per guest",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 34,
        "w": 12,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sort_desc(pbs_snapshot_vm_count and on(vm_id) max by (vm_id) (label_replace(pve_guest_info{template!=\"1\"}, \"vm_id\", \"$1\", \"id\", \"(?:qemu|lxc)/([0-9]+)\")))",
          "legendFormat": "{{vm_name}}",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "orientation": "horizontal",
        "displayMode": "gradient",
        "showUnfilled": true,
        "valueMode": "color",
        "namePlacement": "left",
        "sizing": "auto"
      }
    },
    {
      "id": 19,
      "type": "row",
      "title": "🖥️ PBS server",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 38,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 20,
      "type": "stat",
      "title": "Uptime",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 39,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_host_uptime",
          "legendFormat": "Uptime",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": []
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 21,
      "type": "stat",
      "title": "CPU",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 4,
        "y": 39,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_host_cpu_usage * 100",
          "legendFormat": "CPU",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 70
              },
              {
                "color": "red",
                "value": 90
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 22,
      "type": "stat",
      "title": "Memory used",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 8,
        "y": 39,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "100 * pbs_host_memory_used / pbs_host_memory_total",
          "legendFormat": "RAM",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 85
              },
              {
                "color": "red",
                "value": 95
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 23,
      "type": "stat",
      "title": "System disk used",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 39,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "100 * pbs_host_disk_used / pbs_host_disk_total",
          "legendFormat": "Disk",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 75
              },
              {
                "color": "red",
                "value": 85
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 24,
      "type": "stat",
      "title": "IO wait",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 16,
        "y": 39,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_host_io_wait * 100",
          "legendFormat": "IO wait",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 10
              },
              {
                "color": "red",
                "value": 25
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "decimals": 1
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 25,
      "type": "stat",
      "title": "Version",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 20,
        "y": 39,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_version",
          "legendFormat": "{{version}}",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "mappings": []
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "name",
        "justifyMode": "center",
        "orientation": "auto",
        "wideLayout": true
      }
    },
    {
      "id": 26,
      "type": "timeseries",
      "title": "PBS load during the day",
      "description": "Backups, prune, garbage collection and verify jobs show up as peaks.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 43,
        "w": 24,
        "h": 7
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_host_cpu_usage * 100",
          "legendFormat": "CPU %",
          "refId": "A",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "pbs_host_io_wait * 100",
          "legendFormat": "IO wait %",
          "refId": "B",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 2,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "calcs": [
            "lastNotNull",
            "min",
            "max"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    }
  ]
}