check-snapshot-age aktualisiert

This commit is contained in:
2026-02-12 20:38:17 +01:00
parent d50d3e02ed
commit 856fa7eb4c
+2 -5
View File
@@ -5,23 +5,20 @@ import re
import time
import argparse
# ZFS-Pfad ermitteln
zfs = subprocess.check_output(["which", "zfs"]).decode().strip()
# Argumente verarbeiten
parser = argparse.ArgumentParser(description="ZFS Snapshot Übersicht")
parser.add_argument("--filter", help="Nur bestimmte Datasets anzeigen (Regex möglich, z.B. 'rpool/ROOT')", type=str)
args = parser.parse_args()
# Snapshots abrufen
_snapshots = subprocess.check_output([zfs, "list", "-t", "snapshot", "-Hpo", "name,creation"])
_snapshots = subprocess.check_output(["zfs", "list", "-t", "snapshot", "-Hpo", "name,creation"],encoding="utf-8")
_datasets = {}
# Snapshots parsen
for _datastore, _snapshot, _creation in re.findall(
r"^([\w_./-]+)@([\w_.:-]+)\t(\d+)",
_snapshots.decode('utf-8'),
_snapshots,
re.M):
if args.filter and not re.search(args.filter, _datastore):