Skip to main content

max / mountaineer

515 B · 20 lines History Blame Raw
1 #!/bin/sh
2 # yambar `zfs` segment feed: ZFS pool health summary from sysop.
3 #
4 # Emits one yambar record on each poll:
5 # state|string|ok (all pools ONLINE)
6 # state|string|degraded (any pool non-ONLINE)
7 #
8 # Routes operator into `sysop storage` when state != ok.
9
10 set -eu
11
12 while :; do
13 summary="$(sysop storage --summary 2>/dev/null || echo 'degraded')"
14 case "$summary" in
15 ok) printf 'state|string|ok\n\n' ;;
16 *) printf 'state|string|degraded\n\n' ;;
17 esac
18 sleep 10
19 done
20