Is there any way to see the output in MB?
When I issue zmprov ga mail@domain | grep zimbraMailQuota
Thank you!
Question regarding zimbraMailQuota
Re: Question regarding zimbraMailQuota
Anyone? Should I just try to solve this via scripting? or is there another way?
Thank you
Thank you
- JDunphy
- Outstanding Member
- Posts: 897
- Joined: Fri Sep 12, 2014 11:18 pm
- Location: Victoria, BC
- ZCS/ZD Version: 9.0.0_P39 NETWORK Edition
Re: Question regarding zimbraMailQuota
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
Re: Question regarding zimbraMailQuota
edit: explained myself better below.
Last edited by alexia on Fri Dec 17, 2021 3:00 am, edited 1 time in total.
Re: Question regarding zimbraMailQuota
Looks great. How about i get these results but on a single account that I need to check.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
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
- JDunphy
- Outstanding Member
- Posts: 897
- Joined: Fri Sep 12, 2014 11:18 pm
- Location: Victoria, BC
- ZCS/ZD Version: 9.0.0_P39 NETWORK Edition
Re: Question regarding zimbraMailQuota
Perhaps this then.
Jim
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
Re: Question regarding zimbraMailQuota
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
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