Waynebird
Waynebird

Reputation: 227

Simple Plone statistics over time

I want to evaluate some statistics of my Plone installation and first of all I wanted to know how the total number of Pages of my Plone changing over time.

I had a look at the existing Plone statistics addons. Unfortunately there are none for Plone 5.0. I got quintagroup.analytics running. This addon has interesting metrics, but does not help me seeing the development over time.

So i started programming myself. In order to get the current number of Pages I plan to use a catalog query like this:

catalog = getToolByName(self.context, 'portal_catalog')
catalog.searchResults({'portal_type': 'Document'})
return len(results)

The python script should be run by a cron job every hour and write the result to a log file for me to evaluate later.

My question for you is: Are there any simpler solutions I did not see? Would my solution work? Do you see any conceptual errors in that? I wonder that there are not more questions like that on the internet. Are people not that much interested in the metrics of their CMS, or did I ignore an obvious simple solution for that? At the moment the solution does not yet ron, because of my inexperience with the structure of the plone addons, especially calling a python script, but I am working on that.

Upvotes: 0

Views: 97

Answers (2)

Ulrich Schwarz
Ulrich Schwarz

Reputation: 7727

You could use the data the catalog itself provides:

portal_catalog.Indexes['portal_type'].uniqueValues(withLengths=True)

gives you counts for all types, as a list of (name, count) tuples:

(('CaptchaField', 2), ('Collection', 2), ('Document', 676), ...

I've not double-checked if this avoids searching and len-ing the results, but it's easier than catalog searches if you think you might be interested in more than one type.

(I've only checked this on 4.3.x/Archetypes, but I see no reason it would not work with 5.x/Dexterity as long as it still uses portal_catalog.)

Upvotes: 1

tisto
tisto

Reputation: 1347

If you go to "Site Setup" -> "Dexterity Content Types" you can see how many objects of a certain content type currently exist in your site, e.g.:

http://plonedemo.kitconcept.com/@@dexterity-types

There is no out-of-the box way to gather or present those statistics over time though.

Upvotes: 2

Related Questions