Hello all,
First I have an old HP-UX box(11.21) for which I need to implement file-system utilization monitoring. I choosed to use bdf and a simple for loop. However sometimes the output of bdf is as this one(this is actually form linux but the idea is the same)
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-rootlv 9.3G 923M 8.2G 11% /
udev 2.5G 12K 2.5G 1% /dev
tmpfs 995M 528K 995M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.5G 0 2.5G 0% /run/shm
/dev/mapper/vg00-tmplv 950M 30M 920M 4% /tmp
/dev/mapper/vg00-varlv
4.7G 615M 4.1G 13% /var
BLABLA:BLAA 950M 30M 920M 4% /home2
My question is how can I extract only the value of Use%?
The loop is something like:
usep="output from bdf"
if [ $usep -ge 90 ]
then
echo "Fs full"
fi
I tried awk print but since we have an line with one column less this didn`t work, I have also tried cut but I cannot find universal enough delimiter as the device might be named /dev/vx/ for example or HOST:SHARE.
Any help will be greatly appreciated since I am banging my head with this almost 3h.
p.s. The power of perl is also welcome