posted at: 11:57 am on Mon 23rd Oct 2006 , filed under: NFS, SysAdmin, NetApp, programming, SNMP

I had written a shell script to query the NetApp filers for user and qtree quota about 4+ years ago. Its been in production at work since then and has found immense use. I finally efforted a modified and generalized version of that utilitiy and ported it to perl, now that I have the net-snmp perl module installed.

Download the perl script here

Read the mage page here

The script will allow your users to obtain user and qtree quota related information without gaining access to the filer console. It uses the SNMP MIB from NetApp and the perl Net::SNMP module.

Usage:

rajeev@box% ./getquota.pl -help
	
Options:
   -help   Print usage info and exit.
	
  -man    Print the manual page and exist. 
	
  -home   Query and print the user quota information. If no username is
                 passed, then the quota information for the running user is
                 provided. Optionally, a username and the hosting filer name can
                 be passed to query the usage information of that user. See
                 EXAMPLES below.
	
   -filer     Filer name where the resource is exported from
	
   -volume Volume name. Requires -f.
	
    -qtree  Qtree name. Requires -f and -v.

Obtaining user quota information

Most places I know use the NetApp user quotas for the home directories and mount them at /home/username. As a normal user, you can get the home directory usage information with this script as follows:

rajeev@box% ./getquota.pl -home
	
Home Area quota for: rajeev
	
Current Usage: 1.3 GB
Current Limit: 2 GB


To obtain quota information for a specific qtree in a given volume:

rajeev@box% ./getquota.pl -f toaster -v projects -q ABC
	
Quota for: /vol/projects/ABC
	
Current Usage: 1 GB
Current Limit: 1.6 GB
# of Files Used: 64105

In addition to reporting the space consumption, the script will also spit out the # of files being used.

To obtain a volume specific information:

rajeev@box% ./getquota.pl -f toaster -v projecta
	
Quota for: /vol/projecta/
	
Current Usage: 725.9 GB
Current Limit: 794.6 GB
# of Files Used: 24791968

From the above info, I can also infer that my average file size is around 30KB - and also there are lots of them. This might help in designing your backup environments, snapmirror etc. as well.

Technorati Tags: , ,