check-auto-snapshot-metrik.py.py gelöscht
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import glob
|
|
||||||
import re
|
|
||||||
|
|
||||||
result = {}
|
|
||||||
perf_data = []
|
|
||||||
|
|
||||||
# Cron-Dateien finden
|
|
||||||
cron_paths = glob.glob("/etc/cron*/*-auto-snapshot")
|
|
||||||
|
|
||||||
for path in cron_paths:
|
|
||||||
try:
|
|
||||||
with open(path, 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
label_match = re.search(r'--label=([a-zA-Z]+)', content)
|
|
||||||
keep_match = re.search(r'--keep=(\d+)', content)
|
|
||||||
if label_match and keep_match:
|
|
||||||
label = label_match.group(1)
|
|
||||||
keep = int(keep_match.group(1))
|
|
||||||
result[label] = keep
|
|
||||||
except Exception:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Wenn leer → CRIT
|
|
||||||
if not result:
|
|
||||||
print("2 auto_snapshots - No auto-snapshot cron jobs found")
|
|
||||||
else:
|
|
||||||
status_line = " ".join([f"{k}={v}" for k, v in sorted(result.items())])
|
|
||||||
|
|
||||||
# Performance-Daten mit Beispiel-Warn-/Krit-Grenzen
|
|
||||||
for label, keep in sorted(result.items()):
|
|
||||||
if label == "hourly":
|
|
||||||
perf_data.append(f"{label}={keep};80;60;0;150")
|
|
||||||
elif label == "daily":
|
|
||||||
perf_data.append(f"{label}={keep};10;7;0;30")
|
|
||||||
elif label == "weekly":
|
|
||||||
perf_data.append(f"{label}={keep};4;2;0;10")
|
|
||||||
elif label == "monthly":
|
|
||||||
perf_data.append(f"{label}={keep};2;1;0;5")
|
|
||||||
elif label == "frequent":
|
|
||||||
perf_data.append(f"{label}={keep};10;5;0;30")
|
|
||||||
else:
|
|
||||||
perf_data.append(f"{label}={keep};;;") # Ohne Schwellen
|
|
||||||
|
|
||||||
print(f"0 auto_snapshots - {status_line} | {' '.join(perf_data)}")
|
|
||||||
Reference in New Issue
Block a user