Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install zopehealthwatcher

How to install ZopeHealthWatcher

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install zopehealthwatcher
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3 Available View build log
Windows (64-bit)
0.3 Available View build log
Mac OS X (10.5+)
0.3 Available View build log
Linux (32-bit)
0.3 Available View build log
Linux (64-bit)
0.3 Available View build log
 
Author
Dependencies
Lastest release
version 0.3 on Jan 5th, 2011

ZopeHealthWatcher allows you to monitor the threads of a Zope application, wether it's a Zeo client, wether it's a plain Zope server.

For each thread running on your server, you will know if it's active or idling. When it's active, you will get an execution stack.

It's also useful to debug in case of a locked thread : you'll know where the problem is located.

You can monitor it through your browser or through a console script.

ZopeHealthWatcher is based on DeadlockDebugger code, see http://plone.org/products/deadlockdebugger.

Installation

If you run zc.buildout, add the ZopeHealthWatcher product into your buildout file.

For example

[buildout]

parts = zhw

[zhw] recipe = zc.recipe.egg

eggs = ZopeHealthWatcher scripts = zope_health_watcher

You can also install it using pip or easy_install.

Configuration

Once the package is installed, open the custom.py module located in ZopeHealthWatcher and change ACTIVATED and SECRET values, so the tool is activated:

System Message: WARNING/2 (<string>, line 47)

Literal block expected; none found.

ACTIVATED = True SECRET = 'MySuperPass'

Usage

There are two ways to query the tool: with the zope_health_watcher script or through the browser.

zope_health_watcher

zope_health_watcher takes the root URL of the Zope server to run:

$ zope_health_watcher http://localhost:8080

System Message: ERROR/3 (<string>, line 62)

Inconsistent literal block quoting.

Idle: 4 Busy: 1 OK - Everything looks fine

It will return the number of idling and busy threads.

In case your server is on high load (e.g. 4 busy threads), the tool will return some relevant infos like the time, the sysload (only linux), the memory information (only linux) and for each busy thread, the current stack of execution, the query, the url and the user agent:

$ zope_health_watcher http://localhost:8080

System Message: ERROR/3 (<string>, line 73)

Inconsistent literal block quoting.

Information: Time 2009-05-18T18:23:34.415319 Sysload Meminfo

Dump: Thread -1339518976 QUERY: GET /test? URL: http://localhost:8080/test HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10 File "/Volumes/MacDev/bitbucket.org/zopewatcher/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py", line 25, in __init__ response=b) ... roles = getRoles(container, name, value, _noroles)

Thread -1340051456 QUERY: GET /test? URL: http://localhost:8080/test HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10 File "/Volumes/MacDev/bitbucket.org/zopewatcher/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py", line 25, in __init__ response=b) ... roles = getRoles(container, name, value, _noroles)

Thread -1341648896 not busy

Thread -1341116416 QUERY: GET /test? URL: http://localhost:8080/test HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10 File "/Volumes/MacDev/bitbucket.org/zopewatcher/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py", line 25, in __init__ response=b) ... roles = getRoles(container, name, value, _noroles)

Thread -1340583936 QUERY: GET /test? URL: http://localhost:8080/test HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10 File "/Volumes/MacDev/bitbucket.org/zopewatcher/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py", line 25, in __init__ response=b) ... roles = getRoles(container, name, value, _noroles)

Idle: 1 Busy: 4 WARNING - Warning, high load

If the server is down or unreachable, the script will return a failure:

$ bin/zope_health_watcher http://localhost:8080

System Message: ERROR/3 (<string>, line 124)

Inconsistent literal block quoting.

Idle: 0 Busy: 0 FAILURE - [Errno socket error] (61, 'Connection refused')

zope_watcher is also returning the right exit codes, so it can be used by third party programs like Nagios:

  • OK = 0
  • WARNING = 1
  • FAILURE = 2
  • CRITICAL =3
web access

An HTML version is accessible through the web, using the url http://host:port/manage_zhw?secret. This url has to be changed depending on the values entered in custom.py.

Beware that this URL is not password protected.

http://bitbucket.org/tarek/zopewatcher/raw/ca8cb8e237eb/ZHW.png

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.