View Single Post
  #8 (permalink)  
Old 02-02-2009, 12:30 PM
mmorse mmorse is offline
Zimbra Consultant
 
Posts: 5,814
Default

Quote:
Originally Posted by mlanner View Post
Is there a way to print a summary of each account and/or domain to find the total amount of storage used?
Grand summary by domain:
Code:
zmprov gqu `zmhostname` | grep domain.com | awk '{ sum += $3; } END { print sum; }'
Walkthrough:

Navigate to a directory writable by zimbra, or create one (so that we can use > & < out/in to a file later).

CLI:
Quote:
zmprov GetQuotaUsage localhost
Spits it out in bytes. Second column is max quota (0=unlimited). Third column will be used amount.
Quote:
user@domain.com 0 1234
To flip the output order could do something like:
Code:
 zmprov gqu `zmhostname` | awk {'print " "$3" "$2" "$1'} > sizes.txt
Quote:
1234 0 user@domain.com
SOAP GetQuotaUsageRequest
Code:
zmsoap -z -v -e GetQuotaUsageRequest domain=domain.com
GetQuotaUsageResponse is still per user, just limited search to domain.
Quote:
<GetQuotaUsageResponse xmlns="urn:zimbraAdmin" searchTotal="#" more="0">
<account name="user@domain.com" id="string" limit="0" used="265941" ></account>
But combining grep for domain with awk, plus another awk to sum the numbers using something like:
Quote:
awk '{ sum += $1; } END { print sum; }' < sizes.txt
And all together you get:
Code:
zmprov gqu `zmhostname` | grep domain.com | awk {'print " "$3" " '} > sizes.txt
awk '{ sum += $1; } END { print sum; }' < sizes.txt
Simply remove | grep domain.com if you want everyone.

Combined onto one line you can find out how much space everyone's taking up (well keep in mind there's single-instance storage for those on the same mailstore):
Code:
zmprov gqu `zmhostname` | awk '{ sum += $3; } END { print sum; }'
Quote:
Originally Posted by mlanner View Post
Any plans on bringing some kind of reporting functionality to the admin UI in the future?
Admin console: Server Statistics > Server > Mailbox Quota tab ?

Looking for better search on quota/by domain in the admin console?
There's some RFE's open like Bug 17343 - domain statistics & Bug 13419 - Admin>ServerStatistics>MailboxQuota: cant easily search/view quota of an account check them/vote/file away.
__________________
-Mike Morse (MCode151)

ZCS-to-ZCS Migrations & Moves | Admin Tools & Tidbits » ZimbraBlog.com | ZimbraCommunity.com

Last edited by mmorse : 02-06-2009 at 02:24 PM.
Reply With Quote