1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-26 06:08:35 +01:00
This commit is contained in:
eoli3n 2021-05-13 23:15:36 +02:00
parent 25a4ad7b28
commit effa8a6eb5

@ -2,9 +2,10 @@
warning=85 warning=85
critical=95 critical=95
target="$1"
# Detect slash FSType # Detect slash FSType
fstype=$(df -l "$1" --output=fstype | sed 1d) fstype=$(findmnt -nT "$target" -o FSTYPE)
# Set query cmd # Set query cmd
if [[ -z "$fstype" ]] if [[ -z "$fstype" ]]
@ -12,10 +13,10 @@ then
exit exit
elif [[ "$fstype" == zfs ]] elif [[ "$fstype" == zfs ]]
then then
zfsroot=$(echo $1 | sed 's:/.*::') zfsroot=$(echo $target | sed 's:/.*::')
pcent=$(zpool list -o cap -H $zfsroot | tr -d '%') pcent=$(zpool list -o cap -H $zfsroot | tr -d '%')
else else
pcent=$(df "$1" --output="pcent" 2>/dev/null | sed 1d | tr -d ' ' | tr -d '%') pcent=$(df "$target" --output="pcent" 2>/dev/null | sed 1d | tr -d ' ' | tr -d '%')
fi fi
json_fmt='{"text": "%s" , "class": "%s" }\n' json_fmt='{"text": "%s" , "class": "%s" }\n'