Wednesday, March 16, 2005

Perl Disk Utilization Report - Transaction Logs

Here is a Perl based subroutine I created which you can add to the Disk Utilization report script giving you an additional column listing the total amount (in gig) consumed by transaction logs in your mdbdata directory.

# Figuring out the total file size for log files located in the priv directory
use File::Find;
$logByteCount=0;
$logdir= "net use t: \\\\@Drivearray[0]\\e\$ >NULL";
system $logdir;
$logpath="\\\\@Drivearray[0]\\@Drivearray[2]\\Program Files\\Exchsrvr\\MDBDATA\\"; print "Scanning $logpath\n";
find(\&log, "t:\\program files\\exchsrvr\\mdbdata");
$gigCount=$logByteCount / 1023741824;
$gigCount=sprintf("%5.2f\n", "$gigCount");
$logdirdelete= "net use t: /d >NULL";
system $logdirdelete;
$nulldelete="del NULL";
system $nulldelete;
sub log { if ((/\.log$/) ){ my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $therest) = stat($_) or die "Unable to stat $_\n";
$logByteCount += $size;

}
}

No comments: