Polish: fleet-status.sh #90

Merged
osobh merged 1 commits from polish-fleet-status into main 2026-07-14 21:34:59 +00:00
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# fleet-status.sh — one-shot health snapshot of every clawstor
# node in the fleet. Run from a workstation with ssh access to
# all of them.
#
# Reports per node:
# * daemon service state
# * FUSE mount state + layer listing
# * each timer's next fire + last result
# * blob store byte count
#
# Configure via NODES env var (space-separated), default = the
# current LAN fleet.
set -uo pipefail
NODES=${NODES:-"tank architect morpheus"}
hr() { printf '%.0s─' {1..66}; echo; }
for host in $NODES; do
hr
echo "$host"
hr
ssh -o ConnectTimeout=5 -o BatchMode=yes "$host" '
printf "%-24s " "daemon:"; systemctl --user is-active clawstor-cluster.service 2>&1
printf "%-24s " "fuse mount:"; systemctl --user is-active clawstor-fuse.service 2>&1
printf "%-24s " "fuse layers:"; ls ~/clawstor-mount 2>/dev/null | tr "\n" " " ; echo
printf "%-24s " "blob store bytes:"; du -sb ~/clawstor-deploy/data 2>/dev/null | awk "{print \$1}"
for t in clawstor-scrub clawstor-gc clawstor-ref-sweep clawstor-snapshot-rotate; do
NEXT=$(systemctl --user list-timers "$t.timer" --no-pager 2>/dev/null | awk "NR==2 {print \$1, \$2, \$3, \$4}")
LAST=$(systemctl --user show "$t.service" --no-pager -p Result 2>/dev/null | cut -d= -f2)
printf "%-24s next=%-25s last=%s\n" "$t:" "${NEXT:--}" "${LAST:--}"
done
' 2>&1 || echo "unreachable"
done
hr