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 five.z2monitor

How to install five.z2monitor

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install five.z2monitor
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.2 Available View build log
Linux (64-bit)
0.2 Available View build log
 
License
ZPL
Imports
Lastest release
version 0.2 on Nov 22nd, 2012

Introduction

This package enable to monitoring of Zope 2 instance from the command line. It plugs zc.monitor (http://pypi.python.org/pypi/zc.monitor) and zc.z3monitor (http://pypi.python.org/pypi/zc.z3monitor) in Zope 2. zc.monitor use zc.ngi server and define another thread to handle monitoring. This way you should still be able to monitor your application even if the HTTPServer is hanging.

Zope config

Add this to your zope.conf to enable the zc.ngi server on the loopback interface on port 8888:

<product-config five.z2monitor>
    bind 127.0.0.1:8888
</product-config>

Probes

This package has been tested with probes coming from different packages:

  • zc.z3monitor
  • Products.ZNagios
  • zc.monitorcache
  • zc.monitorlogstats
  • ztfy.monitor

To register your own probe, just define a new utility providing the zc.z3monitor.interfaces.IZ3MonitorPlugin interface. Like this:

<utility
   component=".zc_uptime"
   provides="zc.z3monitor.interfaces.IZ3MonitorPlugin"
   name="uptime" />

and the component should look like this:

def zc_uptime(connection, database='main'):
    """uptime of the zope instance in seconds"""
    app = App()
    elapsed = time.time() - app.Control_Panel.process_start
    print >> connection, elapsed
    app._p_jar.close()

ZODB connection is always the first parameter. You can add your own parameters after.

Once you start your instance you should see something like:

INFO zc.ngi.async.server listening on ('127.0.0.1', 8888)

The ngi server is started and you can look up values with netcat for example:

echo 'uptime' | nc -i 1 localhost 8888

plone.recipe.zope2instance

If you configure your zope instance using buildout and the plone.recipe.zope2instance recipe (http://pypi.python.org/pypi/plone.recipe.zope2instance). To define the zc.z2monitor host and port use the zope-conf-additional option like this:

[client1]
recipe = plone.recipe.zope2instance
http-address = 8080
user = admin:admin
eggs =
  ${buildout:eggs}
zcml =
  ${buildout:zcml}
zope-conf-additional =
  <product-config five.z2monitor>
    bind 127.0.0.1:8888
  </product-config>

Once the instance is running, you will be able to ask the available probes from the command line using:

bin/instance monitor dbinfo main

which is the equivalent to:

echo 'dbinfo main' | nc -i 1 <zc.monitor host> <zc.monitor port>

To know the registered probes, Use this command:

bin/instance monitor help

Changelog

0.2 (2012-11-05)
  • Add entry point for plone.recipe.zope2instance
  • More documentation
0.1 (2012-11-05)
  • Initial implementation

Subscribe to package updates

Last updated Nov 22nd, 2012

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.