Disk Hogs
[posted 2001/11/16]
Now for an outright goof. In the DiskHogsInfo script in dirs_user_alarms.cfg, I gather 'du' info, obtaining the number of disk blocks for each user homedir. Unfortunately, I had specified the report thresholds incorrectly:
set #logblks = # if madrid 25*=MB # else 250*=MB # endif set #rptblks = # if madrid | murmansk 50*=MB # elsif perf | mus 100*=MB # else 500*=MB # endif
Those should all be =KB, not =MB, of course. I was wondering why there were no more reported disk hogs!
I also changed the last rule to highlight users with twice or four times the quota usage:
rule // report via email if #blks >= #rptblks if #blks >= 2 * #rptblks if #blks >= 4 * #rptblks output mail "--> " . $upper("$dir uses $text(#blks/1024,0) MB") . " <--" else output mail $upper("$dir uses $text(#blks/1024,0) MB") endif else output mail "$dir uses $text(#blks/1024,0) MB" endif endif
This produces reports like:
INFO: DiskHogsInfo Check for excessive disk usage, and report the disk hogs /PUB/PERF_DISK_39/PIG USES 1009 MB /pub/perf_disk_13/porker uses 907 MB /PUB/COMP_DISK_34/PIG USES 1810 MB /PUB/COMP_DISK_31/PIG USES 1610 MB /pub/comp_disk_28/porker uses 891 MB /pub/comp_disk_28/porker uses 577 MB --> /PUB/COMP_DISK_33/HOG USES 2713 MB <-- /pub/comp_disk_29/porker uses 593 MB /pub/comp_disk_23/porker uses 614 MB /PUB/PERF_DISK_44/PIG USES 1585 MB --> /PUB/PERF_DISK_35/HOG USES 2143 MB <-- --> /PUB/PERF_DISK_32/HOG USES 2395 MB <-- /pub/perf_disk_34/porker uses 517 MB ...
For more examples, see Developer's Notes.