Question regarding zimbraMailQuota

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
alexia
Posts: 11
Joined: Wed Oct 27, 2021 1:31 am

Question regarding zimbraMailQuota

Post by alexia »

Is there any way to see the output in MB?

When I issue zmprov ga mail@domain | grep zimbraMailQuota


Thank you!
alexia
Posts: 11
Joined: Wed Oct 27, 2021 1:31 am

Re: Question regarding zimbraMailQuota

Post by alexia »

Anyone? Should I just try to solve this via scripting? or is there another way?

Thank you
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 889
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 9.0.0_P39 NETWORK Edition

Re: Question regarding zimbraMailQuota

Post by JDunphy »

How about this:

Code: Select all

#!/bin/bash
# 
# Printout email disk usage for all accounts in human readable form
#
# usage: zmdu.sh
#
# Required: NEEDS to RUN as THE ZIMBRA USER
#
# Author: Jim Dunphy, assist: Klug from Zimbra forums.
#
# Sorted by highest users 
# 
# su - zimbra
# % zmdu.sh 
#    5G ... user1@example.com
#    3G ... user2@example.com
#  696M ... user3@example.com
#  460K ... user4@example.com
#   27K ... user5i@mail.example.com
# 

zmprov gqu $(zmhostname) | awk '{ $2="";suffix=" KMGT"; for(i=1; $3>1024 && i < length(suffix); i++) $3/=1024; printf "%6s%c ... %s\n", int($3),substr(suffix, i, 1), $1; }' | sort -rh

exit 0
alexia
Posts: 11
Joined: Wed Oct 27, 2021 1:31 am

Re: Question regarding zimbraMailQuota

Post by alexia »

edit: explained myself better below.
Last edited by alexia on Fri Dec 17, 2021 3:00 am, edited 1 time in total.
alexia
Posts: 11
Joined: Wed Oct 27, 2021 1:31 am

Re: Question regarding zimbraMailQuota

Post by alexia »

JDunphy wrote:How about this:

Code: Select all

#!/bin/bash
# 
# Printout email disk usage for all accounts in human readable form
#
# usage: zmdu.sh
#
# Required: NEEDS to RUN as THE ZIMBRA USER
#
# Author: Jim Dunphy, assist: Klug from Zimbra forums.
#
# Sorted by highest users 
# 
# su - zimbra
# % zmdu.sh 
#    5G ... user1@example.com
#    3G ... user2@example.com
#  696M ... user3@example.com
#  460K ... user4@example.com
#   27K ... user5i@mail.example.com
# 

zmprov gqu $(zmhostname) | awk '{ $2="";suffix=" KMGT"; for(i=1; $3>1024 && i < length(suffix); i++) $3/=1024; printf "%6s%c ... %s\n", int($3),substr(suffix, i, 1), $1; }' | sort -rh

exit 0
Looks great. How about i get these results but on a single account that I need to check.

The reason is, we have over 6000 email accounts, so listing them all is not an option, and secondly, its mostly a command that I would use after I assign more space to an account from the administration panel, to check whether the account has gotten the space I assigned through a class or not, I don't know if that makes sense.

Ideally it should run as zmdu.sh user@example.com
and return 5G... user@example.com

Thank you in advance for your help!!!!

Alexia
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 889
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 9.0.0_P39 NETWORK Edition

Re: Question regarding zimbraMailQuota

Post by JDunphy »

Perhaps this then.

Code: Select all

# su - zimbra
% cat /tmp/j.sh 
#!/bin/bash

user=$1
zmprov gmi $user | grep quota| awk '{ suffix=" KMGT"; for(i=1; $2>1024 && i < length(suffix); i++) $2/=1024; printf "%6s%c ... '$user'\n", int($2),substr(suffix, i, 1);  }' 

% /tmp/j.sh helen@example.com
    68M ... helen@example.com
    
Jim
alexia
Posts: 11
Joined: Wed Oct 27, 2021 1:31 am

Re: Question regarding zimbraMailQuota

Post by alexia »

Thank you so much for your time Jim!

This one unfortunately doesn't seem to work for some reason. The first one you shared does work, although it correctly retrieves the list ordered by largest assigned quota, it only returns the list of the accounts within that specific server i run the bash from, not our entire userbase (spread across a few mailbox servers)

Since I am able to look up any account in any of our mailbox servers from any zimbra console, lets say I enter admin zimbra console in mailbox 10, and I can look up and edit an account in mailbox 13 for example, I was wondering if running the bash script in 1 mailbox server would be able to pick up all the addresses within our network

I apologise in advance for my broken english.

Best regards

Alexia
Post Reply