View Single Post
  #1 (permalink)  
Old 10-07-2009, 09:03 AM
anthonyclark anthonyclark is offline
Member
 
Posts: 10
Default get a random sample of user account growth by month

Here's some perl code that may or may not be useful for someone. It's a script to connect to a ZCS instance, get the number of accounts on that system, randomly select a 99% confidence sample with a 4% margin of error, then output the growth by month of those accounts.

You will need to put a file called "auth.yaml" in the script directory, the format is in the script:
Code:
zimbra_ldap:
 ldaphost: LDAP-HOSTNAME-HERE
 imaphost: IMAP-HOSTNAME-HERE
 binddn: uid=zimbra,cn=admins,cn=zimbra
 bindpass: SOMETHING
 authuser: SOMEONE
 authpass: SOMETHING
Output looks something like:

account@example.com, Oct-2008, 1240517
account@example.com, Nov-2008, 892160
account@example.com, Dec-2008, 418252
account@example.com, Jan-2009, 317260
account@example.com, Feb-2009, 470876
account@example.com, Mar-2009, 1017728

To modify the date range, you'll need to edit the script at line 84 and change "( year => 2008, month => 5 )" to whatever you need.

I like to redirect the output from the script to a .csv file. You can then perform whatever analysis you want

Dependencies:
Code:
use Mail::IMAPClient;
use Data::Dumper;
use List::Util qw(sum shuffle);
use DateTime;
use Net::LDAP;
use Config::YAML;
use MIME::Base64;
Comments, modifications greatly appreciated
Attached Files
File Type: txt message-sample-size.txt (3.3 KB, 0 views)
Reply With Quote