Hi All,
Would appreciate your help as to why the following code not showing the correct output. the issue is on the last else cause. I am trying to report on disk space based on percentage usage. for some reason, it's showing output as OK even thou disk space is 90% !!!! any ideas why? thanks!!
df -k | awk '
NR > 1 {
_used=$5; sub(/%/,"",_used);
if(_used >= 90)
_status="CRITICAL"
else if (_used >= 85)
_status="WARN"
else if (_used >= 75)
_status="ATTEN"
else _status="OK"
}
END { print _status }'
df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 9288056 1218896 7597352 95% /
udev 505328 4 505324 1% /dev
tmpfs 205292 312 204980 1% /run
none 5120 0 5120 0% /run/lock
none 513228 0 513228 0% /run/shm