[Zope] Monitoring logged-in users

Paul Winkler pw_lists at slinkp.com
Wed Sep 24 10:12:07 EDT 2003


On Wed, Sep 24, 2003 at 04:22:11AM -0700, Gnanadurai Moses wrote:
> Hi All,
>    How to find out the total number of users logged-in in a zope server at given instant of
> time.  Is there any way to monitor their activities and the effect on perfomance in real time.

Zope has no such feature.
Furthermore, HTTP provides no way of really knowing when someone leaves 
the site, unless they explicitly log off. You have to assume that
somebody who's been inactive for some length of time has left.

You could probably get a good idea what's going on by scanning the
zope access log. It uses a similar format to Apache logs. It wouldn't
be terribly hard to write a little program (separate from zope) that 
periodically (or continually) scans this log and reports whatever 
information you're interested in.  "effect on performance"?  
That depends what you want to measure. Finding out things like
CPU and RAM load will depend on the server OS.

The output of such a daemon could be delivered in any number of ways.
Dump it to an HTML file that's served by zope, using LocalFS or
ExtFile (or even APE).  Or use xmlrpc to upload the file to zope -
but that will needlessly bloat your ZODB with undo data.
Or serve this file via apache or another web server, or heck, use
python's http modules to serve it directly from the daemon.
(Up to you to keep it secure, though.)  
One reason not to rely on ZOpe for serving is that you'd like to know
what's going on even if zope is stuck in a non-responsive state.

The problem here is that zope's access logging will not log a request until
it either successfully completes or propagates an exception such
as NotFound. So if somebody requests a 200 MB binary file and performance
crawls, you won't see the cause until after the request finishes
(if it ever does).

This approach will not really help you track anonymous users, because
there might layers of cacheing between zope and the user
(e.g. user's ISP might do its own cacheing). Tracking anonymous
users is basically hopeless.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's SEISMIC EXPLOSIVE TIGER!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list