Files
server-monitor/install.sh
T
MrYoshii c756195530 Initial commit: server-monitor v1 (Python)
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)
2026-04-12 04:15:02 +02:00

38 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# server-monitor install.sh
set -euo pipefail
INSTALL_DIR="/usr/local/lib/server-monitor"
CONFIG_DST="/etc/server-monitor.toml"
echo "==> Abhängigkeiten installieren..."
apt-get install -y --no-install-recommends smartmontools curl nut-client python3
echo "==> Skripte installieren nach ${INSTALL_DIR}..."
mkdir -p "$INSTALL_DIR/checks"
cp monitor.py config.py state.py notify.py "$INSTALL_DIR/"
cp checks/*.py "$INSTALL_DIR/checks/"
chmod +x "${INSTALL_DIR}/monitor.py"
echo "==> Verzeichnisse anlegen..."
mkdir -p /var/log/server-monitor /var/lib/server-monitor
echo "==> Config installieren..."
if [[ -f "$CONFIG_DST" ]]; then
echo " Config existiert bereits wird nicht überschrieben."
else
cp server-monitor.toml "$CONFIG_DST"
echo " ⚠️ Bitte Token + Chat-ID eintragen in: ${CONFIG_DST}"
fi
echo "==> systemd Units installieren..."
cp systemd/server-monitor.service /etc/systemd/system/
cp systemd/server-monitor.timer /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now server-monitor.timer
echo ""
echo "✅ Fertig! Status prüfen:"
echo " systemctl status server-monitor.timer"
echo " journalctl -u server-monitor.service -f"