I am looking for a tool to send alerts in the form of email or NT alerts when a Qtree reaches some threshold or percentage (say 80%) of it's quota. I want to be able to extract or construct the alert only for certain Qtrees. Our Qtree naming standard makes it simple to identify an NTFS Qtree.
I've thought about automatically generating the Qtree report and writing a tool to parse the information out of the report and generate any alerts needed.
Any tools or suggestions are welcome.
Thanks.
We have a script that writes a file called .usage in each qtree every night. This file contains lines from the "quota report" command that pertain to that qtree. That way if anyone is curious about the disk usage in the qtree, they can just look at the .usage report. Admittedly the report can be up to 24 hours old, but our users are still very happy to have it.
It's a pretty simple perl script.
=================== #! /usr/bin/perl5
open(IN, "rsh home2.Virginia.EDU -n -l root quota report |"); $header = <IN> . <IN> . <IN>; while(<IN>) { @line = split(" "); next if ($tree = $line[3]) eq "-" || $line[1] eq "*"; $rpt{$tree} .= $_; } close(IN); $| = 1; foreach $tree (keys(%rpt)) { open(STDOUT, ">/h2/$tree/.usage"); # /vol/h2 NFS mounted on /h2 print $header; open(OUT, "| sort -k 5rn,5"); print OUT $rpt{$tree}; close(OUT); } =====================
Here is a sample .usage report for the qtree /vol/h2/t2 It is just lines from "quota report" where Tree == "t2", sorted in descending order of Kbytes used.
K-Bytes Files Type ID Volume Tree Used Limit Used Limit Quota Specifier ----- -------- -------- -------- ------- ------- -------- -------- ----------------- tree 3 h2 t2 4966652 8345600 134822 8345600 /vol/h2/t2 user wrp h2 t2 2197636 8345600 52942 8345600 user ajm6q h2 t2 1660472 8345600 61055 8345600 user jtr4v h2 t2 643276 8345600 6415 8345600 user mh9b h2 t2 206612 8345600 6063 8345600 user ct3p h2 t2 194924 8345600 6231 8345600 user mls5w h2 t2 49052 8345600 1035 8345600 user cge4n h2 t2 14304 8345600 1008 8345600 user root h2 t2 4 - 1 -
For reference here are the lines in our quotas file for this qtree:
/vol/h2/t2 tree 8150M 8150K * user@/vol/h2/t2 8150M 8150K
I don't think the second line is strictly necessary, but we include it because it makes the unix "quota" command print a quota of 8150M under certain circumstances.
Steve Losen scl@virginia.edu phone: 804-924-0640
University of Virginia ITC Unix Support