feat: unified fleet telemetry — canonical format, GPS/IP geo, WAN health dashboard

- Rewrite telemetry-synology.sh: canonical GL format (modem_0001/wan keys),
  self-contained metrics (no aiwanbal), Eyeride GPS with IP geo fallback
- Add /api/fleet-telemetry to hub: joins tunnel status with fleet Postgres
- Update dashboard.html: per-device WAN health bars, GPS, signal strength
- Fix hub/ingest.sh normalisation: remap old wan1/wan2 → modem_0001/wan
- Bump SPK version: 0.1-0001 → 0.5.0-0001 for GL parity

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 01:47:02 +00:00
parent d86a7e49b5
commit db04341f7c
6 changed files with 596 additions and 220 deletions
+17 -9
View File
@@ -18,23 +18,31 @@ mkdir -p "$TELEM_DIR" "$BACKUP_DIR"
# ── Normalise telemetry ────────────────────────────────────────────
# Both platforms POST to /api/telemetry.
# GL uses: modem_0001/wan keys, no "platform" field
# Synology uses: wan1/wan2 keys, "platform":"synology"
# Output: unified schema with platform field + wan1/wan2 keys
# Canonical format uses modem_0001/wan keys (matching GL standard).
# Handles three variants:
# - GL (no platform field): add platform="openwrt", pass through
# - GL (platform="openwrt"): already canonical, pass through
# - Old Synology (platform="synology" + wan1/wan2): remap to modem_0001/wan
# - New unified Synology (platform="synology" + modem_0001/wan): pass through
normalise_telemetry() {
local json="$1"
local platform=""
json="$1"
platform=""
platform=$(echo "$json" | grep -o '"platform":"[^"]*"' | cut -d'"' -f4)
if [ -z "$platform" ]; then
# Pre-unified GL telemetry — add platform, remap keys
# Pre-unified GL telemetry — add platform field, keys already canonical
platform="openwrt"
json=$(echo "$json" | sed \
-e 's/"modem_0001"/"wan1"/g' \
-e 's/"platform":"openwrt"/"platform":"'"$platform"'"/')
-e 's/^{/{"platform":"'"$platform"'",/')
fi
# Remap old Synology wan1/wan2 keys to canonical modem_0001/wan
if echo "$json" | grep -q '"wan1"'; then
json=$(echo "$json" | sed \
-e 's/"wan1"/"modem_0001"/g' \
-e 's/"wan2"/"wan"/g')
fi
# Ensure both wan1 and wan2 keys exist (Synology uses wan1/wan2 natively)
echo "$json"
}