Files
AI-Profile-Router/platform/checks/verify-platform.sh
T

80 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -uo pipefail
PASS=0
WARN=0
FAIL=0
pass() { printf 'PASS %s\n' "$*"; PASS=$((PASS + 1)); }
warn() { printf 'WARN %s\n' "$*"; WARN=$((WARN + 1)); }
fail() { printf 'FAIL %s\n' "$*"; FAIL=$((FAIL + 1)); }
echo "== Local AI platform verification =="
ROOT_USE="$(df -P / | awk 'NR==2 {gsub(/%/, "", $5); print $5}')"
if [[ -n "$ROOT_USE" && "$ROOT_USE" -lt 85 ]]; then
pass "Systempartition bei ${ROOT_USE}%"
else
fail "Systempartition bei ${ROOT_USE:-unbekannt}% (Ziel: unter 85%)"
fi
if command -v nvidia-smi >/dev/null 2>&1; then
GPU="$(nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null | head -1)"
[[ -n "$GPU" ]] && pass "GPU erkannt: $GPU" || fail "nvidia-smi liefert keine GPU"
else
fail "nvidia-smi fehlt"
fi
container_healthy() {
local name=$1 state health
state="$(docker inspect --format '{{.State.Status}}' "$name" 2>/dev/null || true)"
health="$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{end}}' "$name" 2>/dev/null || true)"
[[ $state == running && ( -z $health || $health == healthy ) ]]
}
for container in mike-ai-profile-controller mike-ai-router mike-ai-piper mike-ai-open-webui; do
if container_healthy "$container"; then
pass "$container gesund"
else
fail "$container fehlt oder ist nicht gesund"
fi
done
ACTIVE_LLAMA="$(docker ps --format '{{.Names}}' | grep -Ec '^mike-ai-llama-(fast|medium|long|experimental)$' || true)"
if [[ $ACTIVE_LLAMA -eq 1 ]]; then
pass "exakt ein llama.cpp-Profil aktiv"
else
fail "$ACTIVE_LLAMA llama.cpp-Profile aktiv (erwartet: 1)"
fi
for optional in mike-ai-mcp-web mike-ai-mcp-homeassistant mike-ai-mcp-arr mike-ai-mcp-unraid-official; do
if container_healthy "$optional"; then
pass "$optional aktiv"
else
warn "$optional nicht aktiv oder nicht installiert"
fi
done
if docker exec mike-ai-router python -c \
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8081/health', timeout=3)" \
>/dev/null 2>&1; then
pass "Router-Liveness intern erreichbar"
else
fail "Router-Liveness intern nicht erreichbar"
fi
if systemctl list-unit-files --no-legend 2>/dev/null | grep -Eq '(vision-rx|whisper-rx|granite-rx).*enabled'; then
warn "Aktivierte RX-Altlast gefunden"
else
pass "Keine aktivierte RX-Altlast"
fi
if systemctl list-unit-files --no-legend 2>/dev/null | grep -E '(benchmark|race).*enabled' >/dev/null; then
warn "Automatisch aktivierter Benchmark-/Race-Dienst gefunden"
else
pass "Keine automatisch aktivierten Benchmarks"
fi
printf '\nErgebnis: %d PASS, %d WARN, %d FAIL\n' "$PASS" "$WARN" "$FAIL"
[[ "$FAIL" -eq 0 ]]