This commit is contained in:
cutemeli
2025-12-29 11:17:20 +00:00
parent 02c87dd0ee
commit aed70e7107
4 changed files with 0 additions and 112 deletions

View File

@@ -1,15 +0,0 @@
version: "3.8"
services:
uptime-kuma:
image: louislam/uptime-kuma:latest
container_name: uptime-kuma
restart: unless-stopped
volumes:
- /root/monitoring/uptime-kuma:/app/data
ports:
- "127.0.0.1:3001:3001" # nur lokal, reverse proxy via nginx empfohlen
extra_hosts:
- "proxmox.cutemeli.com:10.10.0.1"
- "share.cutemeli.com:10.10.0.1"
- "monitor.cutemeli.com:10.10.0.1"

View File

@@ -1,93 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# ==== KONFIG ====
PUSH_URL="http://127.0.0.1:3001/api/push/O2EhJUkH4n"
LOG_FILE="/var/log/host-health.log"
CURL="/usr/bin/curl"
SYSTEMCTL="/bin/systemctl"
DATESTAMP="$(date -Is)"
# Warn- und Kritisch-Schwellen
CPU_WARN=5.0 # Load > 5 Warnung
CPU_CRIT=10.0 # Load > 10 kritisch
RAM_WARN=85 # >85% RAM Warnung
RAM_CRIT=95 # >95% RAM kritisch
DISK_WARN=80 # >80% Disk Warnung
DISK_CRIT=95 # >95% Disk kritisch
# ==== MESSWERTE ====
CPU_LOAD="$(awk '{print $1}' /proc/loadavg)"
RAM_PCT="$(free | awk '/Mem:/ {printf "%.0f", ($3/$2)*100}')"
DISK_PCT="$(df -P / | awk 'NR==2 {gsub("%","",$5); print $5}')"
# Ping zur Default-Gateway oder extern (hier Google DNS)
PING_MS="$(ping -c1 -W1 8.8.8.8 | awk -F'time=' '/time=/{print $2}' | cut -d' ' -f1 || echo "NaN")"
# Dienste-Status
svc_ok () { $SYSTEMCTL is-active --quiet "$1" && echo OK || echo FAIL; }
NGINX_STATUS="$(svc_ok nginx)"
DOCKER_STATUS="$(svc_ok docker)"
WG_STATUS="$(svc_ok wg-quick@wg0)"
PVEVM_STATUS="$(svc_ok proxmox-vm)"
# ==== STATUS LOGIK ====
STATUS="up"
MSG=""
# CPU Check
if (( $(echo "$CPU_LOAD > $CPU_CRIT" | bc -l) )); then
STATUS="down"; MSG+="CPU:CRIT(${CPU_LOAD}) "
elif (( $(echo "$CPU_LOAD > $CPU_WARN" | bc -l) )); then
MSG+="CPU:WARN(${CPU_LOAD}) "
else
MSG+="CPU:${CPU_LOAD} "
fi
# RAM Check
if [ "$RAM_PCT" -ge "$RAM_CRIT" ]; then
STATUS="down"; MSG+="RAM:CRIT(${RAM_PCT}%) "
elif [ "$RAM_PCT" -ge "$RAM_WARN" ]; then
MSG+="RAM:WARN(${RAM_PCT}%) "
else
MSG+="RAM:${RAM_PCT}% "
fi
# Disk Check
if [ "$DISK_PCT" -ge "$DISK_CRIT" ]; then
STATUS="down"; MSG+="DISK:CRIT(${DISK_PCT}%) "
elif [ "$DISK_PCT" -ge "$DISK_WARN" ]; then
MSG+="DISK:WARN(${DISK_PCT}%) "
else
MSG+="DISK:${DISK_PCT}% "
fi
# Dienste Check
for svc in NGINX:$NGINX_STATUS DOCKER:$DOCKER_STATUS WG:$WG_STATUS PVEVM:$PVEVM_STATUS; do
name="${svc%%:*}"; val="${svc##*:}"
if [ "$val" != "OK" ]; then
STATUS="down"; MSG+="$name:FAIL "
else
MSG+="$name:OK "
fi
done
# Ping (nur Info)
MSG+="PING:${PING_MS}ms"
# ==== PUSH ====
HTTP_CODE="$($CURL -sS -o /tmp/kuma_push.out -w "%{http_code}" \
--get \
--data-urlencode "status=${STATUS}" \
--data-urlencode "msg=${MSG}" \
--data-urlencode "ping=${PING_MS}" \
"${PUSH_URL}")" || true
# Logging
echo "${DATESTAMP} status=${STATUS} msg='${MSG}' http=${HTTP_CODE}" >> "$LOG_FILE"
if [[ "$HTTP_CODE" != "200" ]]; then
echo "${DATESTAMP} ERROR: Kuma Push HTTP ${HTTP_CODE}" >> "$LOG_FILE"
exit 1
fi

View File

@@ -1,4 +0,0 @@
[2025-10-02 16:37:39] [Error: insert into `heartbeat` (`down_count`, `duration`, `important`, `monitor_id`, `msg`, `status`, `time`) values (0, 0, true, 7, 'queryA ETIMEOUT 217.154.245.77', 0, '2025-10-02 14:37:16.510') - SQLITE_CONSTRAINT: FOREIGN KEY constraint failed] {
errno: 19,
code: 'SQLITE_CONSTRAINT'
}

Binary file not shown.