Some checks failed
Lint & Format / detect (push) Failing after 33s
Monorepo Lint / lint-shell (push) Failing after 39s
Monorepo Lint / lint-js (push) Failing after 44s
Lint & Format / js-lint (push) Has been skipped
Lint & Format / py-lint (push) Has been skipped
Lint & Format / sh-lint (push) Has been skipped
Lint & Format / go-lint (push) Has been skipped
RoadChain-SHA2048: c829a60d9a429796 RoadChain-Identity: alexa@sovereign RoadChain-Full: c829a60d9a429796b3d8b8d441cb7d1535b539dc32b3200610679b0df1377958d7370b2a36d8632a34190b20f78edf4753556291b5ef999d3d849b5caa44a95304555ff21209d7b8acf7fb061cf5c2bb4750a0e0b8c1798d66d1aed8fb0d88e13bcbe08027c690a6d9c508910ae1d7e011a7e5686413fa26eed7b1b17b03b6e480aa6d092a15ebd446a5e42d3b474ede1a653301ef98b2ba37e8916cfd411d7fda703f7fe04a4ec0c5c4484b083c577eaa95cd6dc03330f9a8e16622f733e47126d8731f85e338825c762b3a759de6d5dde1ceb13da0ab6b38c3df5bdd4fef06f8dd6dc9a98372c28c64945898c502ab7408c37a34377103627ab3eb09e542fd
40 lines
1.0 KiB
Bash
Executable File
40 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Fleet Monitor Push — checks all workers and pushes results to fleet-monitor
|
|
# Run via cron: */5 * * * * ~/local/scripts/fleet-monitor-push.sh
|
|
set -e
|
|
|
|
MONITOR_URL="https://fleet-monitor.amundsonalexa.workers.dev/push"
|
|
WORKERS=(
|
|
"roadcode-squad"
|
|
"squad-webhook"
|
|
"stats-blackroad"
|
|
"analytics-blackroad"
|
|
"fleet-dashboard"
|
|
"roadpay"
|
|
"road-search"
|
|
"blackroad-stripe"
|
|
)
|
|
|
|
results="["
|
|
first=true
|
|
|
|
for w in "${WORKERS[@]}"; do
|
|
code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "https://${w}.amundsonalexa.workers.dev/health" 2>/dev/null || echo "0")
|
|
up="false"
|
|
[ "$code" = "200" ] && up="true"
|
|
|
|
$first || results+=","
|
|
results+="{\"name\":\"$w\",\"up\":$up,\"code\":$code}"
|
|
first=false
|
|
done
|
|
|
|
results+="]"
|
|
|
|
# Push to fleet-monitor
|
|
curl -s -X POST "$MONITOR_URL" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"workers\":$results}" > /dev/null 2>&1
|
|
|
|
# Log locally
|
|
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) pushed $(echo "$results" | grep -o '"up":true' | wc -l | tr -d ' ')/8 healthy" >> /tmp/fleet-monitor.log
|