Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-2008, 07:14 AM
Member
 
Posts: 10
Default per-folder size from command line?

Hi All,

We have an account here with 140GB in their mailbox. We'd like to get a size for each of their folders without viewing their mailbox in the admin web interface. Ideally this would be a single line command as the zimbra user on the command line interface.

zmmailbox can get all folders, or a single folder but doesn't show message size. Is there any way to do that?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-23-2008, 07:45 AM
Moderator
 
Posts: 7,928
Default

Sorry I don't think it can. Just tried myself and it would appear all you can get is the number of messages and how many are unread
__________________
Reply With Quote
  #3 (permalink)  
Old 10-23-2008, 09:18 AM
Zimbra Employee
 
Posts: 1,434
Default

That data is actually returned by the server. If zmmailbox isn't displaying it, you can still get at it by turning on debug/verbose mode and looking at the "s" attribute on the folder.
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #4 (permalink)  
Old 10-23-2008, 09:37 AM
Moderator
 
Posts: 7,928
Default

dkarp, what commands would need to be used from the CLI ?
__________________
Reply With Quote
  #5 (permalink)  
Old 10-23-2008, 10:12 AM
Zimbra Employee
 
Posts: 1,434
Default

Same commands as normal for fetching folders, only adding either -v for verbose or -d for debug. (Not sure which is the one you want -- try and see.)
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #6 (permalink)  
Old 10-23-2008, 10:20 AM
Moderator
 
Posts: 7,928
Default

Code:
su - zimbra
zmmailbox -v -d
mbox> aa admin@zcs admin_password
mbox> selectMailbox user@domain.com
mbox> gf Inbox
gf -v Inbox
{
 "id": "2",
 "name": "Inbox",
 "path": "/Inbox",
 "parentId": "1",
 "flags": null,
 "color": "defaultColor",
 "unreadCount": 0,
 "messageCount": 85,
 "view": "message",
 "url": null,
 "effectivePermissions": null
}
even specifying -v when called with gf it does not show any additional attributes. Even when using gaf only the number of messages/unread are shown.
__________________
Reply With Quote
  #7 (permalink)  
Old 10-23-2008, 10:33 AM
Member
 
Posts: 10
Default

I used "zmmailbox -d -z -m REMOVED@removed.edu gaf" and got the SOAP response back. Piping that into " grep -E '\"name\"|\"s\"' " will, with some editing, give you a per-folder list for that user.
Reply With Quote
  #8 (permalink)  
Old 01-09-2009, 12:29 PM
Active Member
 
Posts: 26
Default

Quote:
Originally Posted by anthonyclark View Post
I used "zmmailbox -d -z -m REMOVED@removed.edu gaf" and got the SOAP response back. Piping that into " grep -E '\"name\"|\"s\"' " will, with some editing, give you a per-folder list for that user.
Thanks for the tip.

I found another way to get folder size by using mysql as zimbra user. The size information is in metadata field in mboxgroupX .mail_item table. Here are steps (and I have script if anyone is interested):

1. Find account's zimbraID - zmprov ga <account> zimbraID

2. Find folder id that you are interested - zmmailbox -z -m <account> gf /folder, store the id number in folder_id.

3. Find group_id and id using mysql from zimbra.mailbox table:
mysql -N -e "select group_id, id from zimbra.mailbox where account_id='zimbraID'

For next mysql select, the mboxgroup database is mboxgroup$group_id, and the mailbox_id is id.

4. Find the folder message count and size:
mysql -N -e "select size,metadata from $mboxgroup.mail_item mailbox_id=$mail box_id and id=$folder_id

The "size" field is actually the message counts in the folder, and the size of the folder is in metadata, for example: you has something like this for the metadata:

d1:ai1e3:i4ri145047e4:mseqi307394e2:szi155818706e4 :unxti148219e1:vi10ee

The folder size is the number after the :szi, in bytes.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.