从python监视和控制apache web服务器工作程序

apache-manager的Python项目详细描述


https://travis-ci.org/xolox/python-apache-manager.svg?branch=masterhttps://coveralls.io/repos/xolox/python-apache-manager/badge.svg?branch=master

apache管理器包有助于收集有关 Apache web server并杀死超过资源阈值的工作进程。 它通过解析由apache的 mod_status模块。它目前在Python2.6、2.7、3.4、3.5、3.6上进行了测试, 3.7和派比。

Status

一方面,apache管理器包是基于许多 多年与Apache web server交互(和监视)的经验 使用apache本身提供的接口(mod_status)以及 Linux操作系统接口(/proc)。

另一方面,python包本身是全新的:它是由 2015年6月至9月。

再说一遍,我对测试覆盖率很有信心,所以有一点:-)。

尽管自动化测试覆盖了整个软件包,但我还没有 提交向后兼容,因为我首先要运行此包 在一段时间的生产环境中 它很坚固。我还需要评估整合当前 监控系统的解决方案(这是一个目标,但我并不总能实现 我第一次尝试的目标是…)。

Installation

apache管理器包可以在PyPI上使用,这意味着安装 应该简单到:

$ pip install apache-manager

实际上有很多方法可以安装python包(例如per user site-packages directoryvirtual environments),或者只安装 我不打算在这里讨论,所以 如果这让你感到害怕,那么在回到这些之前,先阅读一下你的选项 说明;-)。

Usage

有两种方法可以使用apache管理器包:作为命令行 程序apache-manager,并作为python api。有关python的详细信息 api请参阅Read the Docs上提供的api文档。这个 命令行界面如下所述。

Command line

用法:apache manager[选项]

用于监视apache web服务器并杀死worker的命令行界面 超过资源阈值的进程。当没有给出选项时 服务器度量和工作线程的内存使用量将打印到终端。

支持的选项:

OptionDescription
^{tt3}$, ^{tt4}$This option causes the Apache manager to redraw the collected metrics once every 10 seconds in a “top” like interface until interrupted using “q” (for quite) or Control-C.
^{tt5}$, ^{tt6}$Kill active Apache workers that are using more memory than specified by the ^{tt7}$ argument. ^{tt7}$ is expected to be a human readable memory size like 50K (50 kilobytes), 42M (42 megabytes), 2G (2 gigabytes), etc.
^{tt9}$, ^{tt10}$Kill Apache workers that are using more memory than specified by the ^{tt7}$ argument (see ^{tt12}$ for acceptable values of ^{tt7}$).
^{tt14}$, ^{tt15}$, ^{tt16}$Kill Apache workers whose “time since the beginning of the most recent request” is greater than specified by the ^{tt17}$ argument. ^{tt17}$ is expected to be a human readable timespan like 2s (2 seconds), 3m (3 minutes), 5h (5 hours), 2d (2 days), etc.
^{tt19}$, ^{tt20}$Change the pathname of the file where the Apache manager stores monitoring metrics after every run. Defaults to “/tmp/apache-manager.txt”.
^{tt21}$, ^{tt22}$Generate a JSON fragment that’s compatible with the low-level discovery support in the Zabbix monitoring system. With the right template in place this enables the Zabbix server to discover the names of the WSGI process groups that are active on any given server. This makes it possible to collect and analyze the memory usage of specific WSGI process groups.
^{tt23}$, ^{tt24}$, ^{tt25}$Don’t actually kill any Apache workers.
^{tt26}$, ^{tt27}$Increase verbosity (can be repeated).
^{tt28}$, ^{tt29}$Decrease verbosity (can be repeated).
^{tt30}$, ^{tt31}$Show this message and exit.

Contact

apache管理器的最新版本可以在PyPIGitHub上找到。这个 文档位于Read the Docs上,并包含一个changelog。对于Bug 报告请在GitHub上创建问题。如果你有问题,建议, 等等,请随时给我发一封电子邮件peter@peterodding.com

License

此软件是根据MIT license授权的。

?2019彼得·奥丁。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java迭代集合   java Tomcat请求因超时而取消   如何在java主程序的后台实现事件侦听器?   java使用正则表达式进行拆分,但将第一个数组元素作为空白   java从Documentum查询中读取自定义双精度值   java Android:位图内存不足错误   java Lucene复合查询搜索   java如何修复Struts DispatchAction上的StackOverflower错误?   用于从字符串中捕获数字的java正则表达式   java如何禁用来自外部jar的类或包的记录器   java“调用init方法失败;嵌套异常为javax.persistence.PersistenceException”是什么意思?   异步任务中的java Volatile和Synchronized   互联网上的java UDP。它是如何工作的?   java如何禁用“RMI TCP连接”日志记录?   安卓在Java中除以两个整数会得到0还是100?   spring boot如何在JAVA中的3个实体之间使用乐观锁定   matlab如何在Java中创建空格,轻松运行程序,并查看不同代码段的不同颜色以使其可读?   java无法解析类com。云蜂。哈德逊。插件。文件夹文件夹   java转换时区指定为GMT的日期字符串