cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor Spaces disk size

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi all

We are using now the new Alfresco V3.3. We have created four spaces defined to store four types of documentation.Also we would like to monitor every night the amount of MB of each of those spaces. Is there any way we can calculate the space of each space folder so we can send it by mail?

Our idea was to build a java task to send this information by mail and set it up with the Alfresco scheduled … but which could be the best way to calculate the space of each space?

Thanks a lot
5 REPLIES 5

darryl_staflund
Champ in-the-making
Champ in-the-making
Hi there,

I haven't actually tried this on Spaces, but in theory it sounds good 🙂  If you take a look at the following service:


org.alfresco.service.cmr.usage.UsageService

you will see the following method defined:


public long getTotalDeltaSize(NodeRef usageNodeRef);

If you pass in a node reference to the space in question, it should return back its size (in bytes, I believe.)

I know this works for documents as I have used it to generate reports, but I am not sure about spaces.  If it doesn't work for spaces, you can definitely iterate over the space's children and sum up their deltas to obtain a consumption estimate.

I hope this helps.

Darryl

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi Darry

Thanks a lot!! Will give it a try and let you know how it goes  Smiley Very Happy

Cheers

darryl_staflund
Champ in-the-making
Champ in-the-making
Hi again,

I was looking through my code and found that the following might also work to retrieve usage information:


Long usage = (Long) nodeService.getProperty(nodeRef, ContentModel.PROP_SIZE_CURRENT);

In my case, nodeRef was a Person noderef – not a space or content noderef.  But again, it looks like it might work.

Darryl

cboita
Champ in-the-making
Champ in-the-making
Hi all,

I was looking throw that code, and the result of usage, with Space as noderef or Document as noderef, is null. I think these classes are used for Person noderef.

To get the content size, you can try this:


    ContentData contentRef =  (ContentData )nodeService.getProperty(spaceNodeRef, ContentModel.PROP_CONTENT);
    long size = contentRef.getSize();

But if you want to know the total size of a space (files and sub-spaces), you must sum the size of all files (in that space and it subspaces).
This is my knowledge, if someone knows a good solution to get the size of spaces, please share with us.

Thanks.
cboita

biersen
Champ in-the-making
Champ in-the-making