编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

PHP实现的Supervisord多服务监控工具

wxchong 2024-08-04 02:46:59 开源技术 34 ℃ 0 评论

Supervisord多服务器监控工具

功能

  • 监控无限数量的Supervisord服务器和进程
  • 启动/停止/重启进程
  • 读取标准错误日志
  • 当出现标准错误时启动新的Redmine工单
  • 标准错误发生时发出声音警报
  • 静音声音警报(一段时间后自动恢复)
  • 监控进程正常运行时间状态

安装

  1. 将supervisord-monitor克隆到您的虚拟主机/web根目录:
git clone https://github.com/mlazarov/supervisord-monitor.git
  1. 将application/config/supervisor.php.example复制到application/config/supervisor.php:
cp supervisord-monitor/application/config/supervisor.php.example supervisord-monitor/application/config/supervisor.php
  1. 为您的所有Supervisord服务器启用/取消注释inet_http_server(在supervisord.conf中找到)。
[inet_http_server]
port=*:9001
username="yourusername"
password="yourpass"

更改supervisord.conf后不要忘记重启Supervisord服务。

  1. 编辑supervisord-monitor配置文件并添加您的所有Supervisord服务器:
vim application/config/supervisor.php
  1. 配置您的web服务器,将其中一个虚拟主机指向'public_html'目录。
  2. 打开web浏览器并输入您的虚拟主机URL。

Redmine集成

  1. 打开配置文件:
vim application/config/supervisor.php
  1. 将以下行更改为您的redmine URL和自动分配的ID:
// Redmine新问题URL路径
$config['redmine_url'] = 'http://redmine.url/path_to_new_issue_url';
// 默认的Redmine分配者ID
$config['redmine_assigne_id'] = '69';

故障排除

Did not receive a '200 OK' response from remote server.

在大多数情况下,这意味着Supervisord监控工具没有直接的网络访问权限到Supervisord RPC2 http接口。检查您的防火墙和网络连接。


Did not receive a '200 OK' response from remote server. (HTTP/1.0 401 Unauthorized)

401 Unauthorized意味着您的Supervisord监控工具和Supervisord之间有连接,但是用户名或密码错误。

这意味着您的supervisord服务没有启用rpc接口(仅限Supervisord v3+)。要启用rpc接口,请在配置文件中添加以下行:

在示例配置文件中,有一个名为[rpcinterface:supervisor]的部分。默认情况下,它看起来像这样:

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[rpcinterface:supervisor]部分必须保留在配置中,以确保标准的supervisor设置正常工作。如果您不希望supervisor做任何它本来就没有做的事情,这就是您需要了解的所有关于这种类型部分的信息。

有关更多信息,请访问官方Supervisord配置文档:http://supervisord.org/configuration.html#rpcinterface-x-section-settings

The requested URL /control/ ... was not found on this server.

如果您在每个操作(停止,开始,重启等)上都收到此错误,很可能您的web服务器没有尊重在public_html目录中找到的.htaccess文件。要测试这一点,您可以在httpd.conf(如果您使用的是Apache)中添加AllowOverride All配置,或者将.htaccess文件中的规则添加到httpd.conf文件中。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表