You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
1.1 KiB
Bash
21 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
read -e out
|
|
stat=`echo $out | sed "s/^STATUS: \([[:digit:]]\+\); .*/\1/"`
|
|
out=`echo $out | sed "s/^[^;]\+; //"`
|
|
|
|
if [[ "$stat" -eq "3" && "$out" =~ "ERROR : Unknown storage" ]]; then
|
|
echo "OK: No user storages"
|
|
exit 0
|
|
else
|
|
# First sed instance cuts OK/CRITICAL and/or class from everything else; Second gets rid of < threshold %; Third creates breaks between filesystems
|
|
# DISK OK: class '\''system'\'': /: 16% (OK) /export: 16% (OK) /export/home: 16% (OK) /: 16% (OK) /: 16% (OK) /rpool: 16% (OK) /var: 16% (OK)| /=16% /export=16% /export/home=16% /=16% /=16% /rpool=16% /var=16%
|
|
# OK : /: 7%used(4440MB/61497MB) /var: 7%used(3971MB/61028MB) /tmp: 0%used(1MB/5186MB) : < 50 % | /=4440MB;30748;36898;0;61497 /var=3970MB;30513;36616;0;61027 /tmp=1MB;2593;3111;0;5186
|
|
pout=`echo "$out" | cut -d'|' -f1 | sed -e 's/\(^[^:]\+:\(\| class '"'"'[^:]\+:\)\) /\1<br>\n/;s/ : [<>] [[:digit:]]\+ %[[:space:]]*$//' -e 's/\(\(\/[^:]*\|[A-Z]\{1\}\): [^%]\+%\(used\| (\)[^)]\+)\) /\1<br>\n<br>\n/g'`
|
|
perfout=`echo "$out" | cut -d'|' -f2`
|
|
out="${pout} | ${perfout}"
|
|
|
|
echo "$out"
|
|
exit $stat
|
|
fi
|