-
Notifications
You must be signed in to change notification settings - Fork 0
/
zfs-stat.sh
executable file
·25 lines (22 loc) · 1.08 KB
/
zfs-stat.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
EZKEY="$1"
if [ -z "$EZKEY" ]; then
echo "Requires EZKEY. Aborting."
exit 1
fi
while read POOL; do
# NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
POOLNAME="$(cut -d' ' -f1 <<< $POOL)"
AVAIL="$(cut -d' ' -f2 <<< $POOL)"
curl -sd "stat=zfs $POOLNAME AVAIL&ezkey=$EZKEY&value=$AVAIL" https://api.stathat.com/ez &
USED="$(cut -d' ' -f3 <<< $POOL)"
curl -sd "stat=zfs $POOLNAME USED&ezkey=$EZKEY&value=$USED" https://api.stathat.com/ez &
USEDSNAP="$(cut -d' ' -f4 <<< $POOL)"
curl -sd "stat=zfs $POOLNAME USEDSNAP&ezkey=$EZKEY&value=$USEDSNAP" https://api.stathat.com/ez &
USEDDS="$(cut -d' ' -f5 <<< $POOL)"
curl -sd "stat=zfs $POOLNAME USEDDS&ezkey=$EZKEY&value=$USEDDS" https://api.stathat.com/ez &
USEDREFRESERV="$(cut -d' ' -f6 <<< $POOL)"
curl -sd "stat=zfs $POOLNAME USEDREFRESERV&ezkey=$EZKEY&value=$USEDREFRESERV" https://api.stathat.com/ez &
USEDCHILD="$(cut -d' ' -f7 <<< $POOL)"
curl -sd "stat=zfs $POOLNAME USEDCHILD&ezkey=$EZKEY&value=$USEDCHILD" https://api.stathat.com/ez &
done < <(/sbin/zfs list -pro space /*-{tank,guest} | tail -n+2 | tr -s ' ')