Files
pyTorrent/scripts/check_pytorrent_health.sh
2026-05-19 13:43:37 +00:00

12 lines
380 B
Bash
Executable File

#!/bin/sh
# Note: Simple Nagios-compatible pyTorrent API check; set PYTORRENT_URL if the app is not local.
URL="${PYTORRENT_URL:-http://127.0.0.1:8000/api/health/nagios}"
OUT=$(curl -fsS --max-time "${PYTORRENT_HEALTH_TIMEOUT:-5}" "$URL" 2>&1)
RC=$?
if [ "$RC" -eq 0 ]; then
printf '%s\n' "$OUT"
exit 0
fi
printf 'CRITICAL - pyTorrent health check failed: %s\n' "$OUT"
exit 2