Hi,

FWIW here's a perl script I've used for early detection of mailbox
overflow
Different percentages are tracked because different imail versions
variously
check
against usage in main.mbx, total directory usage (.mbx's ? or all files
?)

Could serve as a starting point for other utilities...

d1.pl
------------------------------------------------------------------
# rwebb march 00

# get user's disk usage and limits as set in registry
# start with directories - so ignore users with nothing at all
# even if they are in registry

use File::Find;

# run through users folders
# use file::find gives us total disk consumption
# by traversing recursively down each user's folders

sub mbox {
    $fname = $File::Find::name;
    if ($fname =~ /main\.mbx$/i)  {     # only main.mbx
       $mbsize = -s $_;
    }
}

$udir = "d:\\imail\\users";    # or wherever ...

opendir(USERS, $udir) || die "Can't find users directory $!";

while ($name = readdir(USERS)) {
        next if $name =~ /^\.\.?$/;     # skip . and ..
        @A=$udir."\\".$name;    # dump users pathname into array @A

        $mbsize=0;
        find(\&mbox, @A);
        $MB {$name} = $mbsize;

        $sum = 0;
        find sub { $sum += -s }, @A;    # use anonymous routine
        $H {$name} = $sum;    # to accumulate diretcory tots
}
closedir(USERS);

# Get imail user data (disk quota) from registry
use Win32::registry;

$regpath="SOFTWARE\\Ipswitch\\Imail\\Domains\\YOUR\.DOMAIN\.COM\\Users";

$main::HKEY_LOCAL_MACHINE->Open($regpath, $users) || die "Open $!";
$users->GetKeys( \@userlist );  # pass array by reference
$j=0;
foreach (@userlist) {
if ($userlist[$j] ne "_aliases")       #ignore aliases
{

$u="SOFTWARE\\Ipswitch\\Imail\\Domains\\YOUR\.DOMAIN\.COM\\Users\\$userlist[

$j]";
$main::HKEY_LOCAL_MACHINE->Open($u, $CurrVer) || die "Open $!";
$CurrVer->GetValues(\%vals);
foreach $k (keys %vals) {
  $key = $vals{$k};
        if ($$key[0] eq "MaxSize") {
   $M{$userlist[$j]} = $$key[2]; #stick maxsize value into hash M
   }
}
}
$j++;
}
print "Mailbox disk usage\n";
       printf "%15s : %10s %10s %10s %10s %10s\n",
                "mailbox","main","used", "max", "main %", "tot %";
       printf "%15s : %10s %10s %10s %10s %10s\n",
                "-------","----","----", "---", "-","-";
foreach $sz (sort { $H{$b} <=> $H{$a} } keys %H) {
    if ($M{$sz}!=0) {
       printf "%15s : %10.0f %10.0f %10.0f %10.2f%s %10.2f%s\n",
                $sz,
                $MB{$sz}, $H{$sz}, $M{$sz},
                100 * $MB{$sz}/($M{$sz}),"%",
                100 * $H{$sz}/($M{$sz}),"%";
    }
    else {
       printf "%15s : %10.0f %10.0f %10s %10s %10s\n",
                $sz, $MB{$sz}, $H{$sz}, "","", "unlimited";
    }

}

------------------------------------------------------------------

I invoke it by

d1.bat

perl d:\imail\d1.pl > d:\imail\checkuse.txt
d:\imail\imail1 -u Checkuse -t postmaster -s "Mailbox usage" -f
d:\imail\checkuse.txt


Output is like ... (looks best in a monospace font!)

Mailbox disk usage
        mailbox :       main       used        max     main %      tot %

        ------- :       ----       ----        ---          -          -

        nbrowne :   36259970  208005523   75000000      48.35%
277.34%
        rthomas :     155682  163894140   25000000       0.62%
655.58%
          gwall :   10623094   81919297   25000000      42.49%
327.68%
       ibridges :   10625530   70306917   25000000      42.50%
281.23%
        sobrien :       4635   70103407   50000000       0.01%
140.21%
         msmith :          0   58312790   25000000       0.00%
233.25%
         pbyrne :   12354564   47013631   25000000      49.42%
188.05%
        arutger :    2884817   34650145   25000000      11.54%
138.60%
        jbloggs :    8313101    8324859                        unlimited

        another :    8275063    8300731   30000000      27.58%
27.67%

etc etc

HTH
Ronan


---------- Original Message ----------------------------------
From: Rodrigo Ot�vio <[EMAIL PROTECTED]>
Date: Thu, 9 Mar 2000 15:46:47 -0300

>How the administrator can be knowing that one mailbox is full?
>Exists some tool or option for this notification?
>
>__________________________________
>Rodrigo Ot�vio Souza Salles
>Coordenador de Tecnologia
>Cia. S�o Geraldo de Via��o
>( 0 (xx) 31 235-3280
>2 0 (xx) 31 235-3281
>* [EMAIL PROTECTED]
>
>
>Please visit http://www.ipswitch.com/support/mailing-lists.html 
>to be removed from this list.
>

Please visit http://www.ipswitch.com/support/mailing-lists.html 
to be removed from this list.

Reply via email to