1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 15:01:59 +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
critical=95
target="$1"
# Detect slash FSType
fstype=$(df -l "$1" --output=fstype | sed 1d)
fstype=$(findmnt -nT "$target" -o FSTYPE)
# Set query cmd
if [[ -z "$fstype" ]]
@ -12,10 +13,10 @@ then
exit
elif [[ "$fstype" == zfs ]]
then
zfsroot=$(echo $1 | sed 's:/.*::')
zfsroot=$(echo $target | sed 's:/.*::')
pcent=$(zpool list -o cap -H $zfsroot | tr -d '%')
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
json_fmt='{"text": "%s" , "class": "%s" }\n'