- Refactor executeCheck to return checkResult struct with metrics map - Add ping check kind (ICMP reachability via system ping, macOS+Linux) - Add ssh-script check kind (remote host exec via SSH, allowlisted scripts) - Add threshold evaluation (warn/crit per metric from check config JSONB) - Add inode tracking to disk check - All 4 existing checks now return structured metrics - 17 check scripts: cpu, memory, load, swap, disk_usage, disk_smart, updates, zfs, process, uptime, oom, journal, time, fd, docker_health, caddy_error_rate, backup_freshness - Auto-deploy via tools/setup-checks.sh -> checks/install.sh on git pull - Add ping to OpenAPI CheckKind enum and generated Go types
30 lines
709 B
Bash
30 lines
709 B
Bash
#!/usr/bin/env bash
|
|
# install all check scripts into the canonical directory.
|
|
# Auto-setup hook called by tools/post-pull.sh.
|
|
set -euo pipefail
|
|
|
|
CLONE_DIR="${HOMELAB_CONTEXT_DIR:-/opt/homelab}"
|
|
CHECK_SRC="$CLONE_DIR/checks"
|
|
CHECK_DST="${OIKOS_CHECK_DIR:-/opt/oikos/checks}"
|
|
|
|
if [ ! -d "$CHECK_SRC" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
mkdir -p "$CHECK_DST"
|
|
|
|
for script in "$CHECK_SRC"/*.sh; do
|
|
name=$(basename "$script")
|
|
if [ "$name" = "install.sh" ]; then continue; fi
|
|
if [ -f "$CHECK_DST/$name" ]; then
|
|
if cmp -s "$script" "$CHECK_DST/$name"; then
|
|
continue
|
|
fi
|
|
fi
|
|
cp "$script" "$CHECK_DST/$name"
|
|
chmod 755 "$CHECK_DST/$name"
|
|
echo "[setup-checks] installed $name"
|
|
done
|
|
|
|
echo "[setup-checks] done"
|