From ff557b04374689cdaed5fd2ee2bfe01c5ccaee6a Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Sat, 17 Jan 2026 09:06:11 -0800 Subject: [PATCH] Add borgmatic metrics collection and Grafana dashboard - New borgmatic_metrics ansible role: - Collects borg repository and archive stats hourly - Exports to Prometheus via textfile collector - Metrics: repo size, dedup ratio, archive count, last backup stats - New Grafana dashboard "Borgmatic Backups": - Repository status and disk usage - Backup size trends over time - New data per backup (bar chart) - Deduplication ratio - Time since last backup with alerting thresholds Co-Authored-By: Claude Opus 4.5 --- ansible/playbooks/indri.yml | 2 + .../roles/borgmatic_metrics/defaults/main.yml | 7 + .../roles/borgmatic_metrics/handlers/main.yml | 6 + .../roles/borgmatic_metrics/tasks/main.yml | 43 + .../templates/borgmatic-metrics.plist.j2 | 21 + .../templates/borgmatic-metrics.sh.j2 | 131 ++++ .../grafana/files/dashboards/borgmatic.json | 734 ++++++++++++++++++ 7 files changed, 944 insertions(+) create mode 100644 ansible/roles/borgmatic_metrics/defaults/main.yml create mode 100644 ansible/roles/borgmatic_metrics/handlers/main.yml create mode 100644 ansible/roles/borgmatic_metrics/tasks/main.yml create mode 100644 ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.plist.j2 create mode 100644 ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.sh.j2 create mode 100644 ansible/roles/grafana/files/dashboards/borgmatic.json diff --git a/ansible/playbooks/indri.yml b/ansible/playbooks/indri.yml index 0759ab6..4645cb4 100644 --- a/ansible/playbooks/indri.yml +++ b/ansible/playbooks/indri.yml @@ -91,6 +91,8 @@ tags: kiwix - role: borgmatic tags: borgmatic + - role: borgmatic_metrics + tags: borgmatic_metrics - role: forgejo tags: forgejo - role: devpi diff --git a/ansible/roles/borgmatic_metrics/defaults/main.yml b/ansible/roles/borgmatic_metrics/defaults/main.yml new file mode 100644 index 0000000..368730a --- /dev/null +++ b/ansible/roles/borgmatic_metrics/defaults/main.yml @@ -0,0 +1,7 @@ +--- +borgmatic_metrics_repo: /Volumes/backups/borg/ +borgmatic_metrics_passcommand: cat /Users/erichblume/.borg/config.yaml +borgmatic_metrics_dir: /opt/homebrew/var/node_exporter/textfile +borgmatic_metrics_script: /Users/erichblume/bin/borgmatic-metrics +borgmatic_metrics_interval: 3600 # seconds between metric collection (hourly) +borgmatic_metrics_log_dir: /opt/homebrew/var/log diff --git a/ansible/roles/borgmatic_metrics/handlers/main.yml b/ansible/roles/borgmatic_metrics/handlers/main.yml new file mode 100644 index 0000000..0b91591 --- /dev/null +++ b/ansible/roles/borgmatic_metrics/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: Reload borgmatic-metrics + ansible.builtin.shell: | + launchctl unload ~/Library/LaunchAgents/mcquack.eblume.borgmatic-metrics.plist 2>/dev/null || true + launchctl load ~/Library/LaunchAgents/mcquack.eblume.borgmatic-metrics.plist + changed_when: true diff --git a/ansible/roles/borgmatic_metrics/tasks/main.yml b/ansible/roles/borgmatic_metrics/tasks/main.yml new file mode 100644 index 0000000..fb73cfa --- /dev/null +++ b/ansible/roles/borgmatic_metrics/tasks/main.yml @@ -0,0 +1,43 @@ +--- +- name: Ensure metrics directory exists + ansible.builtin.file: + path: "{{ borgmatic_metrics_dir }}" + state: directory + mode: '0755' + +- name: Ensure log directory exists + ansible.builtin.file: + path: "{{ borgmatic_metrics_log_dir }}" + state: directory + mode: '0755' + +- name: Ensure bin directory exists + ansible.builtin.file: + path: "{{ borgmatic_metrics_script | dirname }}" + state: directory + mode: '0755' + +- name: Deploy borgmatic-metrics script + ansible.builtin.template: + src: borgmatic-metrics.sh.j2 + dest: "{{ borgmatic_metrics_script }}" + mode: '0755' + +- name: Deploy borgmatic-metrics LaunchAgent plist + ansible.builtin.template: + src: borgmatic-metrics.plist.j2 + dest: ~/Library/LaunchAgents/mcquack.eblume.borgmatic-metrics.plist + mode: '0644' + notify: Reload borgmatic-metrics + +- name: Check if borgmatic-metrics LaunchAgent is loaded + ansible.builtin.command: launchctl list mcquack.eblume.borgmatic-metrics + register: borgmatic_metrics_launchctl_check + changed_when: false + failed_when: false + +- name: Load borgmatic-metrics LaunchAgent if not loaded + ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.borgmatic-metrics.plist + when: borgmatic_metrics_launchctl_check.rc != 0 + changed_when: true + failed_when: false diff --git a/ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.plist.j2 b/ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.plist.j2 new file mode 100644 index 0000000..dea0f65 --- /dev/null +++ b/ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.plist.j2 @@ -0,0 +1,21 @@ + + + + + + Label + mcquack.eblume.borgmatic-metrics + ProgramArguments + + {{ borgmatic_metrics_script }} + + StartInterval + {{ borgmatic_metrics_interval }} + RunAtLoad + + StandardErrorPath + {{ borgmatic_metrics_log_dir }}/mcquack.borgmatic-metrics.err.log + StandardOutPath + {{ borgmatic_metrics_log_dir }}/mcquack.borgmatic-metrics.out.log + + diff --git a/ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.sh.j2 b/ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.sh.j2 new file mode 100644 index 0000000..08fbc9c --- /dev/null +++ b/ansible/roles/borgmatic_metrics/templates/borgmatic-metrics.sh.j2 @@ -0,0 +1,131 @@ +#!/bin/bash +# {{ ansible_managed }} +# Collects borg backup metrics for node_exporter textfile collector + +set -euo pipefail + +export BORG_PASSCOMMAND="{{ borgmatic_metrics_passcommand }}" +BORG_REPO="{{ borgmatic_metrics_repo }}" +OUTPUT_FILE="{{ borgmatic_metrics_dir }}/borgmatic.prom" +TEMP_FILE="${OUTPUT_FILE}.tmp" + +# Check if borg is available via mise +BORG_CMD="mise x -- borg" + +# Get repository info +repo_json=$($BORG_CMD info --json "$BORG_REPO" 2>/dev/null) || { + echo "Failed to get borg repo info" >&2 + # Write down metric + cat > "$TEMP_FILE" << 'EOF' +# HELP borgmatic_up Borg backup repository is accessible +# TYPE borgmatic_up gauge +borgmatic_up 0 +EOF + mv "$TEMP_FILE" "$OUTPUT_FILE" + exit 0 +} + +# Get archive list +archives_json=$($BORG_CMD list --json "$BORG_REPO" 2>/dev/null) || { + echo "Failed to list borg archives" >&2 + exit 1 +} + +# Extract repository stats +total_size=$(echo "$repo_json" | jq -r '.cache.stats.total_size') +total_csize=$(echo "$repo_json" | jq -r '.cache.stats.total_csize') +unique_size=$(echo "$repo_json" | jq -r '.cache.stats.unique_size') +unique_csize=$(echo "$repo_json" | jq -r '.cache.stats.unique_csize') +total_chunks=$(echo "$repo_json" | jq -r '.cache.stats.total_chunks') +unique_chunks=$(echo "$repo_json" | jq -r '.cache.stats.total_unique_chunks') + +# Count archives +archive_count=$(echo "$archives_json" | jq -r '.archives | length') + +# Get last archive info +last_archive_name=$(echo "$archives_json" | jq -r '.archives[-1].name // empty') + +if [ -n "$last_archive_name" ]; then + # Get detailed info for the last archive + last_archive_json=$($BORG_CMD info --json "${BORG_REPO}::${last_archive_name}" 2>/dev/null) || { + echo "Failed to get last archive info" >&2 + last_archive_json="" + } + + if [ -n "$last_archive_json" ]; then + last_original_size=$(echo "$last_archive_json" | jq -r '.archives[0].stats.original_size') + last_compressed_size=$(echo "$last_archive_json" | jq -r '.archives[0].stats.compressed_size') + last_deduplicated_size=$(echo "$last_archive_json" | jq -r '.archives[0].stats.deduplicated_size') + last_nfiles=$(echo "$last_archive_json" | jq -r '.archives[0].stats.nfiles') + last_start=$(echo "$last_archive_json" | jq -r '.archives[0].start') + last_end=$(echo "$last_archive_json" | jq -r '.archives[0].end') + last_duration=$(echo "$last_archive_json" | jq -r '.archives[0].duration') + + # Convert timestamp to unix epoch + last_timestamp=$(date -j -f "%Y-%m-%dT%H:%M:%S" "${last_start%.*}" "+%s" 2>/dev/null || echo "0") + fi +fi + +# Write metrics +cat > "$TEMP_FILE" << EOF +# HELP borgmatic_up Borg backup repository is accessible +# TYPE borgmatic_up gauge +borgmatic_up 1 + +# HELP borgmatic_repo_original_size_bytes Total original size of all archives (sum of what each backup contains) +# TYPE borgmatic_repo_original_size_bytes gauge +borgmatic_repo_original_size_bytes $total_size + +# HELP borgmatic_repo_compressed_size_bytes Total compressed size of all archives +# TYPE borgmatic_repo_compressed_size_bytes gauge +borgmatic_repo_compressed_size_bytes $total_csize + +# HELP borgmatic_repo_deduplicated_size_bytes Actual disk usage after deduplication (unique data) +# TYPE borgmatic_repo_deduplicated_size_bytes gauge +borgmatic_repo_deduplicated_size_bytes $unique_csize + +# HELP borgmatic_repo_total_chunks Total number of chunks across all archives +# TYPE borgmatic_repo_total_chunks gauge +borgmatic_repo_total_chunks $total_chunks + +# HELP borgmatic_repo_unique_chunks Number of unique chunks (after deduplication) +# TYPE borgmatic_repo_unique_chunks gauge +borgmatic_repo_unique_chunks $unique_chunks + +# HELP borgmatic_archive_count Number of archives in the repository +# TYPE borgmatic_archive_count gauge +borgmatic_archive_count $archive_count +EOF + +# Add last archive metrics if available +if [ -n "${last_original_size:-}" ]; then + cat >> "$TEMP_FILE" << EOF + +# HELP borgmatic_last_archive_original_size_bytes Original size of the last archive (data being backed up) +# TYPE borgmatic_last_archive_original_size_bytes gauge +borgmatic_last_archive_original_size_bytes $last_original_size + +# HELP borgmatic_last_archive_compressed_size_bytes Compressed size of the last archive +# TYPE borgmatic_last_archive_compressed_size_bytes gauge +borgmatic_last_archive_compressed_size_bytes $last_compressed_size + +# HELP borgmatic_last_archive_deduplicated_size_bytes Deduplicated size of last archive (new data added) +# TYPE borgmatic_last_archive_deduplicated_size_bytes gauge +borgmatic_last_archive_deduplicated_size_bytes $last_deduplicated_size + +# HELP borgmatic_last_archive_files Number of files in the last archive +# TYPE borgmatic_last_archive_files gauge +borgmatic_last_archive_files $last_nfiles + +# HELP borgmatic_last_archive_timestamp Unix timestamp of the last backup +# TYPE borgmatic_last_archive_timestamp gauge +borgmatic_last_archive_timestamp $last_timestamp + +# HELP borgmatic_last_archive_duration_seconds Duration of the last backup in seconds +# TYPE borgmatic_last_archive_duration_seconds gauge +borgmatic_last_archive_duration_seconds ${last_duration:-0} +EOF +fi + +# Atomic move +mv "$TEMP_FILE" "$OUTPUT_FILE" diff --git a/ansible/roles/grafana/files/dashboards/borgmatic.json b/ansible/roles/grafana/files/dashboards/borgmatic.json new file mode 100644 index 0000000..59eb9a4 --- /dev/null +++ b/ansible/roles/grafana/files/dashboards/borgmatic.json @@ -0,0 +1,734 @@ +{ + "annotations": { + "list": [] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { "color": "red", "index": 0, "text": "DOWN" } + }, + "type": "value" + }, + { + "options": { + "1": { "color": "green", "index": 1, "text": "UP" } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { "color": "red", "value": null }, + { "color": "green", "value": 1 } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 4, "x": 0, "y": 0 }, + "id": 1, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_up", + "refId": "A" + } + ], + "title": "Repository Status", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "blue", "value": null }] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 5, "x": 4, "y": 0 }, + "id": 2, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_repo_deduplicated_size_bytes", + "refId": "A" + } + ], + "title": "Disk Usage (Deduplicated)", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "green", "value": null }] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 5, "x": 9, "y": 0 }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_last_archive_original_size_bytes", + "refId": "A" + } + ], + "title": "Data Being Backed Up", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "purple", "value": null }] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 3, "x": 14, "y": 0 }, + "id": 4, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_archive_count", + "refId": "A" + } + ], + "title": "Archives", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { "color": "green", "value": null }, + { "color": "yellow", "value": 86400 }, + { "color": "red", "value": 172800 } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 4, "x": 17, "y": 0 }, + "id": 5, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "time() - borgmatic_last_archive_timestamp", + "refId": "A" + } + ], + "title": "Time Since Last Backup", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 1, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { "color": "red", "value": null }, + { "color": "yellow", "value": 2 }, + { "color": "green", "value": 5 } + ] + }, + "unit": "x" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 3, "x": 21, "y": 0 }, + "id": 6, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_repo_original_size_bytes / borgmatic_repo_deduplicated_size_bytes", + "refId": "A" + } + ], + "title": "Dedup Ratio", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "orange", "value": null }] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 4, "x": 0, "y": 4 }, + "id": 7, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_last_archive_deduplicated_size_bytes", + "refId": "A" + } + ], + "title": "Last Backup New Data", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "cyan", "value": null }] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 4, "x": 4, "y": 4 }, + "id": 8, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_last_archive_files", + "refId": "A" + } + ], + "title": "Files in Backup", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { "color": "green", "value": null }, + { "color": "yellow", "value": 60 }, + { "color": "red", "value": 300 } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 4, "x": 8, "y": 4 }, + "id": 9, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_last_archive_duration_seconds", + "refId": "A" + } + ], + "title": "Last Backup Duration", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "semi-dark-blue", "value": null }] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { "h": 4, "w": 4, "x": 12, "y": 4 }, + "id": 10, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_repo_unique_chunks", + "refId": "A" + } + ], + "title": "Unique Chunks", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "green", + "mode": "fixed" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 20, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "green", "value": null }] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 }, + "id": 11, + "options": { + "legend": { + "calcs": ["lastNotNull", "min", "max"], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_last_archive_original_size_bytes", + "legendFormat": "Backup Size (if extracted)", + "refId": "A" + } + ], + "title": "Backup Size Over Time", + "description": "The original (uncompressed, non-deduplicated) size of each backup - this is how much data would be restored", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "fixed" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 20, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "blue", "value": null }] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 }, + "id": 12, + "options": { + "legend": { + "calcs": ["lastNotNull", "min", "max"], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_repo_deduplicated_size_bytes", + "legendFormat": "Repository Size on Disk", + "refId": "A" + } + ], + "title": "Repository Disk Usage Over Time", + "description": "Actual disk space used by the backup repository (after compression and deduplication)", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "orange", + "mode": "fixed" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [{ "color": "orange", "value": null }] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { "h": 8, "w": 24, "x": 0, "y": 16 }, + "id": 13, + "options": { + "legend": { + "calcs": ["mean", "max", "lastNotNull"], + "displayMode": "table", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.0.0", + "targets": [ + { + "datasource": { "type": "prometheus", "uid": "prometheus" }, + "expr": "borgmatic_last_archive_deduplicated_size_bytes", + "legendFormat": "New Data Added", + "refId": "A" + } + ], + "title": "New Data Per Backup", + "description": "How much new (deduplicated) data each backup added to the repository", + "type": "timeseries" + } + ], + "refresh": "5m", + "schemaVersion": 38, + "tags": ["borgmatic", "backup", "borg"], + "templating": { + "list": [] + }, + "time": { + "from": "now-30d", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Borgmatic Backups", + "uid": "borgmatic", + "version": 1, + "weekStart": "" +}