[OpenAFS] Re: quota monitoring

Heiko Schulz hrs@mathematik.uni-stuttgart.de
Wed, 27 Aug 2003 09:34:15 +0200 (CEST)


> Robin Yamaguchi <rhy@physics.ucsb.edu> writes:
> 
> > I couldn't figure out a way to do this without locally storing the admin
> > passwd, and cat pwfile | klog admin -pipe.  I then fs listquota all
> > volumes, grep "WARNING", then send e-mail accordingly.
> 
> > Anyone have a better way using -localauth instead of using klog -pipe?
> 
> Sneaky little trick on obtaining quota information: fs listquota requires
> access to the directory, but vos examine and vos listvol don't.  Use vos
> listvol on each of your servers and parse that output instead.

Here is a corresponding stupid script, called via cron:

>>>>>>>>>>
#!/bin/sh

LOG="/tmp/check_home_vols.log"
VOS="/usr/afs/bin/vos"
rm -f $LOG
touch $LOG
warncapacity="90"

$VOS listvldb -quiet -noauth | grep home | while read vol
do
  vosexa=`$VOS exa $vol -loc`
  maxquota=`echo $vosexa | awk -F " " '{print $16}'`
  used=`echo $vosexa | awk -F " " '{print $4}'`
  if [ "$maxquota" != "0" ]; then
    capacity=`echo $used/$maxquota*100 | bc -l | awk '{printf("%2.2lf\n", $1)}'`
    capacityint=`echo $capacity | cut -d. -f1`
    [ "$capacityint" -ge "$warncapacity" ] && echo $vol: $capacity >> $LOG
# else
#   user=`echo $vol | awk -F "." '{print $2}'`
#   echo "$user has unlimited quota."
  fi
done

cat $LOG
rm -f $LOG
>>>>>>>>>>


--
Dr. Heiko Schulz
Fachbereich Mathematik
Systemadministration
Pfaffenwaldring 57
Raum 8.313
Universität Stuttgart

Tel.   : (0711) 685 5344
Fax    : (0711) 685 5348
E-Mail : schulz@mathematik.uni-stuttgart.de