CentOS 7.x Zimbra mailbox quota usage report

From Notes_Wiki

Home > CentOS > CentOS 7.x > Email configuration > Zimbra configuration > CentOS 7.x Zimbra mailbox quota usage report

It is important to be able to see mailbox quota usage of various users. For this we can do admin login, go to Configure -> Domains. Right click on domain and click Edit. Then click on 'Mailbox Quota'. However this is manual and we cannot export the report to share with others.

Other option is to use below script which prepares email with quota information of all users and sends it as email. The script is modified to share only used quota and not allotted quota and mailbox status. Reference link or commented line in script has information on how to add overall allotted quota or mailbox status also.

Create following script as '/opt/zimbra-account-usage.sh with 'chmod +x and with 'chown zimbra:zimbra'

#!/bin/bash
output="/tmp/zimbra-account-usage"
domain="example.com"
SendTo="saurabh@example.com admin2@example.com"

rm -f $output
touch $output

server=`zmhostname`
/opt/zimbra/bin/zmprov gqu $server|grep $domain|awk {'print $1" "$3" "$2'}|sort|while read line
do
usage=`echo $line|cut -f2 -d " "`
quota=`echo $line|cut -f3 -d " "`
user=`echo $line|cut -f1 -d " "`
status=`/opt/zimbra/bin/zmprov ga $user | grep  ^zimbraAccountStatus | cut -f2 -d " "`
#echo "$user `expr $usage / 1024 / 1024`Mb `expr $quota / 1024 / 1024`Mb ($status account)" >> $output
usage2=`expr $usage / 1024 / 1024 `
usage3=`printf '%10s' $usage2`
echo "$usage3 Mb    $user" >> $output
done

cat $output | mail -S sendmail=/opt/zimbra/common/sbin/sendmail -s"Mailbox Usages for $domain" $SendTo


Refer:


Home > CentOS > CentOS 7.x > Email configuration > Zimbra configuration > CentOS 7.x Zimbra mailbox quota usage report