CentOS 7.x Zimbra mailbox quota usage report

From Notes_Wiki
Revision as of 12:15, 2 April 2019 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb self="Zimbra mailbox quota usage report">CentOS_7.x_Zimbra_configuration|Zimbra configuration</yambe:breadcrumb> =CentOS 7.x Zimbra mailbox quota usage repor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb self="Zimbra mailbox quota usage report">CentOS_7.x_Zimbra_configuration|Zimbra configuration</yambe:breadcrumb>

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:


<yambe:breadcrumb self="Zimbra mailbox quota usage report">CentOS_7.x_Zimbra_configuration|Zimbra configuration</yambe:breadcrumb>