supervisor集群管理

https://blog.51cto.com/qiangsh/2153185

supervisor不支持跨机器的进程监控,一个supervisord只能监控本机上的程序,大大限制了supervisor的使用。

不过由于supervisor本身支持xml-rpc,因此也有一些基于supervisor二次开发的多机器进程管理工具。比如:

Django-Dashvisor
Web-based dashboard written in Python. Requires Django 1.3 or 1.4.
Nodervisor
Web-based dashboard written in Node.js.
Supervisord-Monitor
Web-based dashboard written in PHP.
SupervisorUI
Another Web-based dashboard written in PHP.
cesi
cesi is a web interface provides manage supervizors from same interface.

cesi具体安装说明请直接参考原Readme。这里只做一点说明:

git clone https://github.com/Gamegos/cesi
cd cesi && mkdir pack
python setup.py build
python setup.py install
sqlite3 /自己的路径path/userinfo.db < userinfo.sql
cp cesi.conf /etc/cesi.conf ### 自行修改cesi.conf内容,kv对,很简单
cd cesi && python web.py ### 即可启动成功

cesi.conf配置文件的设置:

[node:local] ### 设置监控的各个机器
username = user
password = 123
host = 192.168.14.8
port = 9001

;[node:<node_name2>] ### 如果有多台机器,就依次添加
;username =
;password =
;host =
;port =

;[environment:<environment_name>]
;members = <node_name>, <node_name2>

[cesi]
database = /root/temp/cesi/userinfo.db ### 设置db路径
activity_log = /root/temp/cesi/cesi.log ### 设置log路径
host = 0.0.0.0

一切顺利的话,可通过页面http://ip:5000,用户名,密码都是admin,最终的效果如下所示:
supervisor集群管理https://github.com/Gamegos/cesi/blob/master/README.md

Install Dependencies For Cesi Api

$ # On Ubuntu [18.04, 16.04, 14.04]
$ sudo apt install -y git python3 python3-pip python3-venv
$ # On Centos 7
$ sudo yum install -y git epel-release
$ sudo yum install -y python34 python34-pip python34-venv
$ # On Fedora 28
$ sudo dnf install -y git python3 python3-pip python3-venv
Install Cesi

$ export CESI_SETUP_PATH=~/cesi
$ mkdir ${CESI_SETUP_PATH}
$ cd ${CESI_SETUP_PATH}

$ # Download the project to ~/cesi directory
$ wget https://github.com/gamegos/cesi/releases/download/v2.6.7/cesi-extended.tar.gz -O cesi.tar.gz
$ tar -xvf cesi.tar.gz

$ # Create virtual environment and install requirement packages
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip3 install -r requirements.txt

$ # Run with command line
(venv) $ python3 ${CESI_SETUP_PATH}/cesi/run.py --config-file ${CESI_SETUP_PATH}/defaults/cesi.conf.toml
Install Cesi as a service

$ # If you want to change CESI_SETUP_PATH, you must change the configurations in the cesi.service file.
$ export CESI_SETUP_PATH=/opt/cesi
$ mkdir ${CESI_SETUP_PATH}
$ cd ${CESI_SETUP_PATH}

$ # Download the project to CESI_SETUP_PATH directory
$ wget https://github.com/gamegos/cesi/releases/download/v2.6.7/cesi-extended.tar.gz -O cesi.tar.gz
$ tar -xvf cesi.tar.gz

$ # Create virtual environment and install requirement packages
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip3 install -r requirements.txt
(venv) $ deactivate # Deactivate virtual environment

$ # Build ui (First you must install dependencies for ui -> yarn) - Optional
$ cd ${CESI_SETUP_PATH}/cesi/ui
$ yarn install
$ yarn build

$ # Create cesi.conf.toml file and update cesi.conf.toml for your environment.
$ # Config file documentation can be found inside default file.
$ # (You must create cesi.conf in the etc directory for cesi.service)
$ sudo cp ${CESI_SETUP_PATH}/defaults/cesi.conf.toml /etc/cesi.conf.toml

$ # Run as a service
$ sudo cp ${CESI_SETUP_PATH}/defaults/cesi.service /etc/systemd/system/cesi.service
$ sudo systemctl daemon-reload
$ sudo systemctl start cesi
Running Cesi with uWSGI

You may want to run Cesi using uWSGI (or any other WSGI deamon). Configure your system in the similiar way to running as a service and use uwsgi to start app. Check defaults/cesi-uwsgi.ini for details.

While running with uWSGI Cesi config host and port are ignored.

First Login
Please change password after first login!

Username: admin
Password: admin