Files
beepi/playbooks/monitoring/grafana/dashboards/backups.json.j2
T
2026-08-16 14:48:04 +02:00

216 lines
8.3 KiB
Django/Jinja

{
"id": null,
"uid": "beepi-backups",
"title": "Backups",
"tags": ["beepi", "backup"],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"refresh": "1m",
"time": {"from": "now-7d", "to": "now"},
"panels": [
{
"type": "table",
"title": "Backup jobs",
"id": 1,
"gridPos": {"h": 7, "w": 24, "x": 0, "y": 0},
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"targets": [
{
"refId": "age",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "time() - max by (backup_job) (backup_last_success_timestamp_seconds{backup_job!=\"\"})",
"instant": true,
"format": "table"
},
{
"refId": "status",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "max by (backup_job) (backup_last_status{backup_job!=\"\"})",
"instant": true,
"format": "table"
},
{
"refId": "duration",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "max by (backup_job) (backup_last_duration_seconds{backup_job!=\"\"})",
"instant": true,
"format": "table"
},
{
"refId": "size",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "max by (backup_job) (backup_last_archive_bytes{backup_job!=\"\"})",
"instant": true,
"format": "table"
}
],
"transformations": [
{"id": "joinByField", "options": {"byField": "backup_job", "mode": "outer"}},
{"id": "organize", "options": {
"excludeByName": {"Time": true, "Time 1": true, "Time 2": true, "Time 3": true, "Time 4": true},
"renameByName": {
"backup_job": "Job",
"Value #age": "Age",
"Value #status": "Status",
"Value #duration": "Duration",
"Value #size": "Archive"
}
}}
],
"fieldConfig": {
"defaults": {"custom": {"align": "auto", "cellOptions": {"type": "auto"}}},
"overrides": [
{"matcher": {"id": "byName", "options": "Age"}, "properties": [
{"id": "unit", "value": "s"},
{"id": "custom.cellOptions", "value": {"type": "color-background"}},
{"id": "thresholds", "value": {"mode": "absolute", "steps": [
{"color": "green", "value": null},
{"color": "orange", "value": 90000},
{"color": "red", "value": 172800}
]}}
]},
{"matcher": {"id": "byName", "options": "Duration"}, "properties": [{"id": "unit", "value": "s"}]},
{"matcher": {"id": "byName", "options": "Archive"}, "properties": [{"id": "unit", "value": "bytes"}]},
{"matcher": {"id": "byName", "options": "Status"}, "properties": [
{"id": "custom.cellOptions", "value": {"type": "color-background"}},
{"id": "mappings", "value": [{"type": "value", "options": {
"0": {"text": "FAILED", "color": "red", "index": 0},
"1": {"text": "ok", "color": "green", "index": 1}
}}]},
{"id": "thresholds", "value": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "green", "value": 1}]}}
]}
]
},
"options": {"showHeader": true}
},
{
"type": "timeseries",
"title": "Archive size",
"id": 2,
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 7},
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"targets": [
{
"refId": "A",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "backup_archive_newest_bytes",
"legendFormat": "newest {{ '{{' }}kind{{ '}}' }}"
},
{
"refId": "B",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "backup_archive_total_bytes",
"legendFormat": "total {{ '{{' }}kind{{ '}}' }}"
}
],
"fieldConfig": {
"defaults": {"unit": "bytes", "custom": {"lineWidth": 2, "fillOpacity": 8}},
"overrides": []
},
"options": {"legend": {"displayMode": "list", "placement": "bottom", "showLegend": true}, "tooltip": {"mode": "multi"}}
},
{
"type": "timeseries",
"title": "Backup duration",
"id": 3,
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 7},
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"targets": [
{
"refId": "A",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "backup_last_duration_seconds{backup_job!=\"\"}",
"legendFormat": "{{ '{{' }}backup_job{{ '}}' }}"
}
],
"fieldConfig": {
"defaults": {"unit": "s", "custom": {"lineWidth": 2, "fillOpacity": 8}},
"overrides": []
},
"options": {"legend": {"displayMode": "list", "placement": "bottom", "showLegend": true}, "tooltip": {"mode": "multi"}}
},
{
"type": "stat",
"title": "Retained archives",
"id": 4,
"gridPos": {"h": 5, "w": 6, "x": 0, "y": 15},
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"targets": [
{
"refId": "A",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "backup_archive_count",
"legendFormat": "{{ '{{' }}kind{{ '}}' }}",
"instant": true
}
],
"fieldConfig": {"defaults": {"unit": "short", "color": {"mode": "thresholds"}, "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "green", "value": 2}]}}, "overrides": []},
"options": {"colorMode": "background", "graphMode": "none", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}}
},
{
"type": "stat",
"title": "RAID mounted",
"id": 5,
"gridPos": {"h": 5, "w": 6, "x": 6, "y": 15},
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"targets": [
{
"refId": "A",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "max(backup_raid_mounted) or vector(0)",
"instant": true
}
],
"fieldConfig": {
"defaults": {
"mappings": [{"type": "value", "options": {"0": {"text": "NOT MOUNTED", "color": "red", "index": 0}, "1": {"text": "mounted", "color": "green", "index": 1}}}],
"thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "green", "value": 1}]}
},
"overrides": []
},
"options": {"colorMode": "background", "graphMode": "none", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}}
},
{
"type": "timeseries",
"title": "RAID free space",
"id": 6,
"gridPos": {"h": 5, "w": 12, "x": 12, "y": 15},
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"targets": [
{
"refId": "A",
"datasource": {"type": "prometheus", "uid": "{{ grafana_prometheus_uid }}"},
"expr": "node_filesystem_avail_bytes{mountpoint=\"{{ backup_raid_mount }}\"}",
"legendFormat": "free"
}
],
"fieldConfig": {"defaults": {"unit": "bytes", "custom": {"lineWidth": 2, "fillOpacity": 8}}, "overrides": []},
"options": {"legend": {"displayMode": "list", "placement": "bottom", "showLegend": true}, "tooltip": {"mode": "single"}}
},
{
"type": "logs",
"title": "Backup log",
"id": 7,
"gridPos": {"h": 12, "w": 24, "x": 0, "y": 20},
"datasource": {"type": "loki", "uid": "{{ grafana_loki_uid }}"},
"targets": [
{
"refId": "A",
"datasource": {"type": "loki", "uid": "{{ grafana_loki_uid }}"},
"expr": "{job=\"backup\"}",
"queryType": "range"
}
],
"options": {
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": true,
"enableLogDetails": true,
"dedupStrategy": "none",
"prettifyLogMessage": false
}
}
]
}