File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,6 +232,52 @@ else
232232 fi
233233fi
234234
235+ # ── Runtime Health ────────────────────────────────────────────────────────────
236+
237+ echo " "
238+ echo " Runtime health:"
239+
240+ # Slack bridge
241+ if curl -s -o /dev/null -w ' %{http_code}' -X POST http://127.0.0.1:7890/send -H ' Content-Type: application/json' -d ' {}' 2> /dev/null | grep -q " 400" ; then
242+ pass " slack bridge responding (port 7890)"
243+ else
244+ warn " slack bridge not responding on port 7890"
245+ fi
246+
247+ # Disk usage
248+ DISK_PCT=$( df / 2> /dev/null | tail -1 | awk ' {print $5}' | tr -d ' %' )
249+ if [ -n " $DISK_PCT " ]; then
250+ if [ " $DISK_PCT " -ge 90 ]; then
251+ fail " disk usage at ${DISK_PCT} % (critical)"
252+ elif [ " $DISK_PCT " -ge 80 ]; then
253+ warn " disk usage at ${DISK_PCT} %"
254+ else
255+ pass " disk usage at ${DISK_PCT} %"
256+ fi
257+ fi
258+
259+ # Stale session sockets
260+ SOCKET_DIR=" $BAUDBOT_HOME /.pi/session-control"
261+ if [ -d " $SOCKET_DIR " ]; then
262+ STALE_SOCKS=0
263+ if command -v fuser & > /dev/null; then
264+ for sock in " $SOCKET_DIR " /* .sock; do
265+ [ -e " $sock " ] || continue
266+ if ! fuser " $sock " & > /dev/null 2>&1 ; then
267+ STALE_SOCKS=$(( STALE_SOCKS + 1 ))
268+ fi
269+ done
270+ if [ " $STALE_SOCKS " -gt 0 ]; then
271+ warn " $STALE_SOCKS stale session socket(s) in $SOCKET_DIR "
272+ else
273+ pass " no stale session sockets"
274+ fi
275+ else
276+ warn " fuser not installed; skipping stale socket check"
277+ fi
278+ fi
279+
280+
235281# ── Summary ──────────────────────────────────────────────────────────────────
236282
237283echo " "
You can’t perform that action at this time.
0 commit comments