跳转到主要内容

ZopeHealthWatcher 允许您监视和调试 Zope 应用程序的线程。

项目描述

ZopeHealthWatcher 允许您监视 Zope 应用程序的线程,无论是 Zeo 客户端还是普通的 Zope 服务器。

对于您服务器上运行的每个线程,您将知道它是活跃的还是空闲的。当它处于活跃状态时,您将获得执行堆栈。

在遇到锁定线程时,它也有助于调试:您将知道问题所在。

您可以通过浏览器或控制台脚本进行监视。

ZopeHealthWatcher 基于 DeadlockDebugger 代码,请参阅 http://plone.org/products/deadlockdebugger

安装

如果您运行 zc.buildout,请将 ZopeHealthWatcher 产品添加到您的 buildout 文件中。

例如

[buildout]

parts =
    zhw

[zhw]
recipe = zc.recipe.egg

eggs = ZopeHealthWatcher
scripts = zope_health_watcher

您也可以使用 pipeasy_install 进行安装。

配置

安装包后,打开位于 ZopeHealthWatcher 中的 custom.py 模块,更改 ACTIVATEDSECRET 的值,以便激活工具

ACTIVATED = True
SECRET = 'MySuperPass'

使用方法

查询工具有两种方式:使用 zope_health_watcher 脚本或通过浏览器。

zope_health_watcher

zope_health_watcher 需要运行 Zope 服务器的根 URL

$ zope_health_watcher http://localhost:8080
Idle: 4 Busy: 1
OK - Everything looks fine

它将返回空闲和忙碌线程的数量。

如果服务器负载高(例如,4 个忙碌线程),则工具将返回一些相关信息,如时间、sysload(仅限 Linux)、内存信息(仅限 Linux),以及对于每个忙碌线程,当前的执行堆栈、查询、URL 和用户代理

$ zope_health_watcher http://localhost:8080
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

如果服务器宕机或不可达,脚本将返回失败

$ bin/zope_health_watcher http://localhost:8080
Idle: 0 Busy: 0
FAILURE - [Errno socket error] (61, 'Connection refused')

zope_watcher 也返回正确的退出代码,因此它可以被像 Nagios 这样的第三方程序使用

  • OK = 0

  • WARNING = 1

  • FAILURE = 2

  • CRITICAL =3

网络访问

通过 URL http://host:port/manage_zhw?secret 可以访问 HTML 版本。此 URL 需要根据 custom.py 中输入的值进行更改。

请注意,此 URL 未受密码保护。

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

项目详情


下载文件

下载适合您平台的应用程序。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分发

ZopeHealthWatcher-0.9.0.tar.gz (168.6 kB 查看哈希值)

上传时间

由以下赞助

AWSAWS 云计算和安全赞助商 DatadogDatadog 监控 FastlyFastly CDN GoogleGoogle 下载分析 MicrosoftMicrosoft PSF赞助商 PingdomPingdom 监控 SentrySentry 错误日志 StatusPageStatusPage 状态页面