Kompletter Neustart als Python-Projekt. Portiert von zfs-monitor Bash v3, saubere Architektur: - config.py: TOML-Config mit dataclasses - state.py: zentrales State-Management (JSON statt Einzeldateien) - notify.py: Telegram + Persistent Alerting als wiederverwendbare Klasse - checks/zfs.py: ZFS Pool-Health, I/O-Fehler, Kapazität - checks/smart.py: SATA + NVMe SMART-Monitoring - checks/nut.py: NUT/USV-Monitoring (APC Back-UPS RS 1500G)
57 lines
1.8 KiB
TOML
57 lines
1.8 KiB
TOML
# ============================================================
|
|
# server-monitor Konfiguration
|
|
# ============================================================
|
|
|
|
[telegram]
|
|
token = "DEIN_TOKEN"
|
|
chat_id = "DEINE_CHAT_ID"
|
|
|
|
[monitoring]
|
|
# hostname = "" # Standard: automatisch via hostname
|
|
log_file = "/var/log/server-monitor/monitor.log"
|
|
state_file = "/var/lib/server-monitor/state.json"
|
|
|
|
# ------------------------------------------------------------
|
|
# Persistent Alerting
|
|
# Monitor läuft alle 5 min via systemd timer.
|
|
# critical_repeat_runs = 1 → jedes Mal (alle 5 min)
|
|
# warning_repeat_runs = 6 → alle 30 min
|
|
# 0 = kein Repeat (einmalig)
|
|
# ------------------------------------------------------------
|
|
[alert]
|
|
critical_repeat_runs = 1
|
|
warning_repeat_runs = 6
|
|
|
|
# ------------------------------------------------------------
|
|
# ZFS
|
|
# ------------------------------------------------------------
|
|
[zfs]
|
|
pools = ["blackhole", "vault"]
|
|
warn_pct = 85
|
|
crit_pct = 95
|
|
timeout = 10
|
|
|
|
# ------------------------------------------------------------
|
|
# SMART
|
|
# ------------------------------------------------------------
|
|
[smart]
|
|
extra_disks = ["/dev/sdp"] # Disks außerhalb von Pools
|
|
reallocated_max = 0
|
|
pending_max = 0
|
|
uncorrectable_max = 0
|
|
temp_max = 55 # °C
|
|
timeout = 15
|
|
|
|
# ------------------------------------------------------------
|
|
# NUT / USV
|
|
# ------------------------------------------------------------
|
|
[nut]
|
|
enabled = false
|
|
# Name(n) aus /etc/nut/ups.conf (upsc <name>@<host>)
|
|
ups = ["ups@localhost"]
|
|
batt_warn_pct = 50 # % Akkuladestand Warnung
|
|
batt_crit_pct = 20 # % Akkuladestand Critical
|
|
load_warn_pct = 80 # % Last Warnung
|
|
runtime_crit_sec = 300 # Sekunden Restlaufzeit bis Critical (5 min)
|
|
timeout = 10
|