Results 1 to 4 of 4

Thread: Domain Statistics Script

  1. #1
    carl.williamson is offline Intermediate Member
    Join Date
    Jul 2012
    Location
    Jersey, Channel Islands
    Posts
    21
    Rep Power
    3

    Default Domain Statistics Script

    Hi Guys,

    I have currently running Zimbra 8.0.2 on Ubuntu 12.04 and I have a question about Zimbra and Linux Bash Scripting.

    I currently have a script that is running every day to report mailbox statistics. e.g. account quota usage, Account status & at the end I wanted to total up the statistics.
    As you can see I added a TOTAL varibale to add how many accounts there are in the example.com domain.
    The problem I now have is I want to total up the domains quota usage but the zmprov gms command writes as a string.

    If anyone has any ideas it would be very helpful.

    Thanks,
    Carl

    Code:
    #!/bin/bash
    
    /opt/zimbra/bin/zmprov -l gaa example.com | while read ACCOUNT
    
    
    do
    QUOTA=`/opt/zimbra/bin/zmprov ga ${ACCOUNT} | grep "zimbraMailQuota" | awk -F\: '{ print $2}'`
    QUOTA=`expr ${QUOTA} / 1024`
    QUOTA=`expr ${QUOTA} / 1024`
    QUOTA="${QUOTA}MB"
    USAGE=` /opt/zimbra/bin/zmmailbox -z -m ${ACCOUNT} gms`
    AS=` /opt/zimbra/bin/zmprov ga ${ACCOUNT} | grep zimbraAccountStatus |awk -F\: '{ print $2}'`
    NAME=` /opt/zimbra/bin/zmprov ga ${ACCOUNT} | grep uid |awk -F\: '{ print $2}'`
    TOTAL=$((TOTAL+1))
    
    echo "Name = ${NAME}">>/tmp/report`date +%d%m%y`.xls
    echo "Email Address = ${ACCOUNT}">>/tmp/report`date +%d%m%y`.xls
    echo "Quota Usage = ${USAGE} OF ${QUOTA}">>/tmp/report`date +%d%m%y`.xls
    echo "Account Status = ${AS}">>/tmp/report`date +%d%m%y`.xls
    echo "***************************">>/tmp/report`date +%d%m%y`.xls
    echo "Total - $(TOTAL)">>/tmp/report`date +%d%m%y`.xls
    echo "***************************">>/tmp/report`date +%d%m%y`.xls
    
    done

  2. #2
    federico.bertola's Avatar
    federico.bertola is offline Special Member
    Join Date
    Jul 2006
    Location
    Verona, Italy
    Posts
    153
    Rep Power
    8

    Default

    Only a simple hint: take a look to the GetQuotaUsage command.
    Code:
    zmprov gqu your.server.name
    My2Cent


    Sent from my iPhone using Tapatalk 2
    Federico Bertola
    CTO @ StudioStorti

  3. #3
    carl.williamson is offline Intermediate Member
    Join Date
    Jul 2012
    Location
    Jersey, Channel Islands
    Posts
    21
    Rep Power
    3

    Default

    Thanks for the reply!

    This command is good but it just gives me a dump of every accounts quota usage.
    where as the reports being produced are domain specific.

    Cheers,

    Carl
    Last edited by carl.williamson; 03-25-2013 at 08:13 AM.

  4. #4
    carl.williamson is offline Intermediate Member
    Join Date
    Jul 2012
    Location
    Jersey, Channel Islands
    Posts
    21
    Rep Power
    3

    Default

    I still need help on this if anyone can chime in?

    Code:
    USAGE=`/opt/zimbra/bin/zmmailbox -z -m ${ACCOUNT} gms`
    If I can convert USAGE into a number and add USAGE to TotalQuota for every ACCOUNT I think it would be sorted.

    If anyone can help out with this it would be greatly appreciated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 01-12-2013, 06:34 AM
  2. Replies: 0
    Last Post: 01-09-2013, 12:50 PM
  3. Replies: 2
    Last Post: 05-01-2012, 01:21 AM
  4. Statistics
    By tibo78100 in forum Administrators
    Replies: 5
    Last Post: 05-14-2010, 02:51 AM
  5. Statistics for Domain Administrator?
    By americo in forum Administrators
    Replies: 1
    Last Post: 01-17-2008, 05:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •