Files
Varaverk/Plugin/unraid/Tools/uptime_probe.sh
T
Gmer4Lfe 1001c25487 Probe every domain every minute, and keep it out of its own traffic numbers
NPM's access log only describes hosts somebody visited; the host most likely to be quietly broken
is the one nobody does. Probes carry a User-Agent npm_access_stats.sh drops — unmarked, this
monitor would be fifty thousand requests a day in the very logs it reports on.
2026-08-15 20:28:30 -04:00

48 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# ==============================================================================================
# ==================================== Uptime Probe ============================================
# ==============================================================================================
#
# PURPOSE
# ─────────────────────────────────────────────────────────────────────────────
# Probes every hostname NPM serves, from outside the proxy, once per run. Produces the uptime
# percentages and history strip on the Proxies tab, and the wobble list for the Sunday report.
#
# NPM's access log only describes hosts somebody visited. The host most likely to be quietly
# broken is the one nobody visited, and nothing was watching those at all.
#
# ==============================================================================================
# OPERATIONAL MODEL
# ==============================================================================================
#
# A wrapper. The work is in uptime_probe.php, which issues all probes in parallel through
# curl_multi so one pass costs about as long as the slowest domain rather than the sum.
#
# Runs every minute, injected by include/scheduler.php alongside the other background writers.
# Nothing about the storage assumes that cadence — everything is counts and time buckets.
#
# Probes carry the User-Agent Varaverk-Uptime/1.0, which npm_access_stats.sh excludes. Without
# that, this monitor becomes fifty thousand requests a day in the logs it reports on.
#
# ==============================================================================================
# RUNTIME MODES
# ==============================================================================================
#
# uptime_probe.sh one pass
# uptime_probe.sh --dry-run probe and report, write nothing
# uptime_probe.sh --status per-domain uptime table (1h / 24h / 30d)
# uptime_probe.sh --events recent state changes, newest first
#
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#
# UPTIME_PROBE_ENABLED master switch
# UPTIME_PROBE_TIMEOUT seconds per domain
# UPTIME_PROBE_LIST_TTL seconds to reuse the cached domain list from NPM
#
# ==============================================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
php "$SCRIPT_DIR/uptime_probe.php" "$@"