Monday, August 24, 2009

Monitoring temporary dbspaces

This script was created by my colleague. The objective is to dump out onstat -d outputs whenever the free spaces in the temporary dbspaces is running low. The script can be modified to change the duration and the amount of free space left before it starts dumping outputs of onstat -d.


chk_space.sh
=================================================
#!/bin/sh
i=0
while [ $i -lt 3600 ]
do
onstat -d | awk -f t_flex.awk |tee ./tt$$.out
fsum=`cut -f 5 -d " " ./tt$$.out`
if [ $fsum -lt 1000000 ]
then
echo "Space is being monitored" $fsum
date >> chk_tmp_$$.out
onstat -d >> chk_tmp_$$.out
fi
i=`expr $i + 1`
echo "Finish Loop: " $i
sleep 1
done
rm ./tt$$.out

=================================================

t_flex.awk
=================================================
/dev\/rawlinks\/temp/ { ssum+=$5;fsum+=$6 }
END { print "Total:",ssum," Free:",fsum }
=================================================

/dev\/rawlinks\/temp/ is the chunk path of temporary dbspaces.

No comments:

Post a Comment