Zope/Plone的Munin插件。
项目描述
历史
该项目最初由RedTurtle Technology以 redturtle.munin 开始。从1.1a1开始,我们将开发转移到 munin.zope,为其他Munin插件留出一些空间。
介绍
此软件包提供用于监控Zope实例各个方面的Munin插件。
它使用gocept.munin进行插件注册。如果您想编写新的插件,请参阅其文档。
代码的部分基于在munin交换找到的插件(对Gaute Amundsen和Arthur Lutz表示感谢)。
插件
目前有4个插件可用
“zopethreads” - 报告免费的Zope线程
“zopecache” - 报告数据库缓存参数
“zodbactivity” - 报告ZODB活动
“zopememory” - 报告Zope内存使用情况(仅在Linux上有效)
如何使用
首先,将包包含在您的buildout 实例槽中
[instance] ... eggs = ... munin.zope zcml = ... munin.zope
如果您使用z3c.autoinclude和plone(从Plone 3.3.x开始默认设置),您只需要egg内容
[instance] ... eggs = ... munin.zope
要创建插件辅助脚本,您还需要包含以下附加部分并扩展您的 部分 定义
[buildout] parts = ... munin [munin] recipe = zc.recipe.egg eggs = munin.zope arguments = http_address='${instance:http-address}', user='${instance:user}'
使用 参数 选项将配置值传递给生成的辅助脚本,然后将其用作实际的munin插件(见下文)。在 实例 部分中给出的任何 ip地址、http地址、端口号 和 用户 设置应在此处重复,用逗号分隔。
请注意,此处使用下划线而不是破折号作为变量名 — 以下列表显示了所有支持的设置及其相应的默认值
ip_address=’<ip地址>’ [‘localhost’]
http_address=<http地址> [8080]
port_base=<端口号> [0]
user=<用户凭证> [未提供]
此处可以使用字面值或对 实例 部分的引用,例如:“http_address=’${instance:http-address}’,user=’${instance:user}’”。请注意,生成的结果行将详细复制到生成的 bin/munin 脚本中,因此需要额外的引号。
当监控多个Zope实例时,例如在ZEO配置中,需要生成单独的辅助脚本。为此,可以使用 zc.recipe.egg 的 scripts 选项,如下所示
[buildout] parts = ... munin1 munin2 [munin1] recipe = zc.recipe.egg eggs = munin.zope scripts = munin=munin1 arguments = http_address='${instance1:http-address}', user='${instance1:user}' [munin2] recipe = zc.recipe.egg eggs = munin.zope scripts = munin=munin2 arguments = http_address='${instance2:http-address}', user='${instance2:user}'
然后可以逐个为每个脚本创建必要的符号链接(见下文)。请注意,在这种情况下,您应明确提供一个不同的 前缀 参数。
现在,您可以像以下那样调用插件
https://#:8080/@@munin.zope.plugins/zopethreads
其中 zopethreads 是您的插件名称。
接下来,您需要将辅助脚本从您的buildout的 bin/ 中创建符号链接到munin插件目录。辅助脚本本身可以协助您完成此操作
$ bin/munin install /opt/munin/etc/plugins [<prefix>] [<suffix>]
这将使用提供的名称前缀和后缀或使用主机名和当前目录来组装其名称(见下文),在指定目录中安装必要的符号链接。
或者,您也可以自己安装所需的符号链接
$ cd /opt/munin/etc/plugins $ ln -s ~/zope/bin/munin company_zodbactivity_site1
在此处 /opt/munin/etc/plugins 是您的munin目录,~/zope/ 是您的buildout的根目录,zodb_activity 是您想要启用的插件名称,company 是任意前缀的占位符,site1 是将在munin中显示的名称。
最后,在munin中配置插件(如果正确设置了步骤2中描述的 参数 选项,则可以跳过此步骤)
$ cd /opt/munin/etc/plugin-conf.d/ $ vi munin.zope.conf ... [company_*_site1] ... env.AUTH myuser:myuser ... env.URL https://#:8080/@@munin.zope.plugins/%s
在此处 myuser:myuser 是您的Zope用户凭证,localhost:8080 是您的站点URL。请访问munin 获取有关插件配置的更多信息。
多个zodb存储
如果您有多个zodb存储,可以通过使用 filestorage 参数并使用 initFilestorages 辅助函数将其添加到脚本中,来管理它,如下所示
[munin] recipe = zc.recipe.egg eggs = munin.zope initialization = from munin.zope.plugins import initFilestorages initFilestorages(['catalog', 'other'])
或者使用 c.r.filestorage
[filestorage] recipe = collective.recipe.filestorage parts = catalog other [munin] recipe = zc.recipe.egg eggs = munin.zope initialization = from munin.zope.plugins import initFilestorages initFilestorages("""${filestorage:parts}""".split()) arguments = http_address='${instance:http-address}', user='${instance:user}'
安全
出于安全原因,视图需要 视图管理屏幕 权限…
… 或者您可以在请求中使用共享密钥,您必须在zope.conf中配置共享密钥,添加如下段
<product-config munin.zope> secret yoursecrethere </product-config>
在您的buildout 实例槽中
zope-conf-additional += <product-config munin.zope> secret yoursecrethere </product-config>
因此,您可以使用密钥进行无认证的请求
https://#:8080/@@munin.zope.plugins/zopethreads?secret=yoursecrethere
您还可以在munin辅助脚本中传递密钥
[munin3] recipe = zc.recipe.egg eggs = munin.zope scripts = munin=munin3 arguments = http_address='${instance2:http-address}', secret='mylittlesecret'
请注意,对于 zopethreads,您需要使用 密钥 方法。
参考资料
munin.zope 在pypi
gocept.munin 在 pypi 上
redturtle.munin 在 pypi 上
munin 项目
联系方式
- Andrew Mleczko <andrew.mleczko at redturtle.net>RedTurtle Technology, http://www.redturtle.net/
- Andreas Zeidler <az at zitc.de>ZITC, http://zitc.de/
- Mauro Amico <mauro at biodec.com>Biodec, http://www.biodec.com/
- Leonardo Rochael Almeida <leorochael@gmail.com>Simples Consultoria, http://www.simplesconsultoria.com.br/
变更日志
2.1 (2014-09-17)
添加辅助函数 initFilestorages 以管理多个 zodb 存储器(zodbactivity,zopecache 插件)[mauro]
2.0 (2013-02-05)
修复 zopethreads 计数,使其不再歪曲其自身空闲线程的计数。提高版本号,因为 zopethreads 已不再通过认证访问,而只能通过“秘密”配置访问。[leorochael]
1.3.3 (2012-12-17)
修复 zeo 客户端/服务器设置中的 totalthread [mauro]
1.3.2 (2012-08-07)
允许在 bin/munin 脚本中传递秘密 [fredvd]
为 Plone 4.2 添加测试运行器 [fredvd]
更新 bootstrap.py 以实现分发兼容性 [fredvd]
管理多个文件存储器(zodbactvity,zopecache 插件)[mauro]
1.3.1 (2012-03-15)
修复 egg 构建:缺少 ZCML 和文档 [mitchellrj]
1.3 (2012-03-08)
使用 plone 目标进行 z3c.autoinclude [mamico]
使用共享秘密进行身份验证 [mamico]
1.2 - 2011/04/28
删除 threadframe 对 python >= 2.5 的依赖 [amleczko]
1.1 - 2010/02/25
在数据检索中将 restrictedTraverse 更改为 unrestrictedTraverse [amleczko]
1.1a1 - 2009/08/13
将包名更改为 munin.zope [amleczko]
1.0a2 - 2009/07/27
修复内存使用插件中的维度问题。 [witsch]
添加有关监控多个实例的信息,例如 ZEO 设置。 [witsch]
允许在设置插件链接时覆盖默认前缀/后缀。 [witsch]
1.0a1 - 2009/07/17
添加脚本来自动设置 munin 插件目录中所有可用插件的符号链接。 [witsch]
添加用于跟踪 zope 内存使用的插件(仅限 Linux)。 [witsch]
添加记录慢速插件执行作为安全网。 [witsch]
允许在 buildout 中直接设置必要的配置值。 [witsch]
重构并尝试简化事物。 [witsch]
0.0.3 - 2009/03/30
添加文档。 [amleczko]
重构插件注册。 [amleczko]
0.0.2 - 2009/03/26
小型重构。 [amleczko]
0.0.1 - 2009/03/24
初始发布。 [amleczko]
项目详情
munin.zope-2.1.zip 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | f41908b88f9bef8b0f2bcb1816217f7c659398526ef6f90c54e45f02e75fde49 |
|
MD5 | 986cfc9285cf5cdc7475c4f8221e1712 |
|
BLAKE2b-256 | 57e30e6aa4f95fd02be2538b9a1397379909fe950e1d477f779089b4798e3380 |