supervisord-monitor监控多个linux主机上supervisord进程管理的所有子进程、基于php开发,web方式管理进程,如启动、关闭、重启、查看子进程运行情况等。
1.开启supervisor的web管理端口
vim /etc/supervisord.conf
[inet_http_server]
port=0.0.0.0:9001
username=admin
password=password
至于supervisor如何管理子进程,请参考我的另一篇文章:Linux进程后台运行方式?
2.下载supervisord-monitor前端php文件:
git clone https://github.com/mlazarov/supervisord-monitor.git
mv supervisord-monitor supervisord
3.编辑php配置文件,添加被监控主机
vim /usr/local/nginx/html/supervisord/Application/config/supervisor.php
$config['supervisor_servers'] = array(
'AliYunWayGit' => array(
'url' => 'http://192.168.31.100/RPC2',
'port' => '9001',
'username' => 'admin',
'password' => 'password'
),
'HomeTestWayGit' => array(
'url' => 'http://192.168.31.101/RPC2',
'port' => '9001',
'username' => 'admin',
'password' => 'password'
),
......
);
4.Nginx配置文件:
server {
listen 80;
server_name supervisord-monitor.test.com;
set $web_root /usr/local/nginx/html/supervisord/public_html;
root $web_root;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
location ~ /*.php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $web_root$fastcgi_script_name;
fastcgi_param SCHEME $scheme;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
access_log /usr/local/nginx/logs/xxx.log;
error_log /usr/local/nginx/logs/xxx_error.log;
}
5.重载nginx使配置生效
nginx -s reload
6.supervisord-monitor管理界面访问
http://supervisord-monitor.test.com