Heartbeat und Überwachung eingeführt

This commit is contained in:
2025-12-19 15:53:46 +00:00
parent df7e6cf1d1
commit 9d46ba9f46
5 changed files with 205 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ services:
restart: unless-stopped
volumes:
- ./videospeicher:/app/videospeicher
- heartbeat:/app
env_file:
- .env
environment:
@@ -14,8 +15,32 @@ services:
- EMAIL_USER=${EMAIL_USER}
- EMAIL_PASS=${EMAIL_PASS}
- SAVE_DIR=${SAVE_DIR}
- HEARTBEAT_FILE=/app/heartbeat.txt
# Führe das Skript alle 5 Minuten aus
command: >
sh -c "while true; do
python main.py && echo \"CameraSave ausgeführt um \$$(date)\" && sleep 300;
done"
done"
monitor:
build: .
container_name: camerasave-monitor
restart: unless-stopped
volumes:
- heartbeat:/app
env_file:
- .env
environment:
- HEARTBEAT_FILE=/app/heartbeat.txt
- CHECK_INTERVAL=600 # Prüfung alle 10 Minuten
- MAX_AGE=900 # Alarm nach 15 Minuten ohne Heartbeat
- ALERT_COOLDOWN=3600 # 1 Stunde zwischen Alarm-E-Mails
- SMTP_SERVER=${SMTP_SERVER:-securesmtp.t-online.de}
- SMTP_PORT=${SMTP_PORT:-587}
- SMTP_USER=${SMTP_USER:-${EMAIL_USER}}
- SMTP_PASS=${SMTP_PASS:-${EMAIL_PASS}}
- ALERT_EMAIL=${ALERT_EMAIL:-${EMAIL_USER}}
command: python monitor.py
volumes:
heartbeat: