Press "Enter" to skip to content

Supervisor集中化管理web工具cesi安装配置

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.

主机环境;
[root@test ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
[root@test ~]# uname -a
Linux test 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
supervisor安装与配置可参考:https://www.tracymc.cn/archives/588

cesi项目地址:https://github.com/gamegos/cesi

具体安装步骤:

[root@test yum.repos.d]# yum install -y sqlite python python-flask
[root@test home]# git clone https://github.com/gamegos/cesi //如果没有git命令,可yum install -y git安装
[root@test home]# cd cesi/
[root@test cesi]# ll
total 72
drwxr-xr-x 4 root root 4096 May 17 21:15 cesi
-rw-r--r-- 1 root root 380 May 17 21:15 cesi.conf
-rw-r--r-- 1 root root 269 May 17 21:15 CONTRIBUTORS.md
drwxr-xr-x 2 root root 4096 May 17 21:15 docker-cesi
-rw-r--r-- 1 root root 35146 May 17 21:15 LICENCE
-rw-r--r-- 1 root root 164 May 17 21:15 MANIFEST.in
-rw-r--r-- 1 root root 1018 May 17 21:15 README.md
drwxr-xr-x 2 root root 4096 May 17 21:15 screenshots
-rw-r--r-- 1 root root 406 May 17 21:15 setup.py
-rw-r--r-- 1 root root 197 May 17 21:15 userinfo.sql
[root@test cesi]# sqlite3 ./userinfo.db < userinfo.sql
上述命令执行完会多一个userinfo.db文件.
root@test cesi]# ll
total 76
drwxr-xr-x 4 root root 4096 May 17 21:15 cesi
-rw-r--r-- 1 root root 380 May 17 21:15 cesi.conf
-rw-r--r-- 1 root root 269 May 17 21:15 CONTRIBUTORS.md
drwxr-xr-x 2 root root 4096 May 17 21:15 docker-cesi
-rw-r--r-- 1 root root 35146 May 17 21:15 LICENCE
-rw-r--r-- 1 root root 164 May 17 21:15 MANIFEST.in
-rw-r--r-- 1 root root 1018 May 17 21:15 README.md
drwxr-xr-x 2 root root 4096 May 17 21:15 screenshots
-rw-r--r-- 1 root root 406 May 17 21:15 setup.py
-rw-r--r-- 1 root root 3072 May 17 21:17 userinfo.db //多出这个文件
-rw-r--r-- 1 root root 197 May 17 21:15 userinfo.sql
查看表:
[root@test cesi]# sqlite3 userinfo.db
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
userinfo
sqlite> select * from userinfo;
admin|admin|0
sqlite> .quit

配置cesi.conf:
[root@test cesi]# cp /home/cesi/cesi.conf /etc/ //启动的默认配置文件为/etc/cesi.conf,这一点一定要注意
[root@test cesi]# cat /etc/cesi.conf
[node:test01]
username = test01
password = test01
host = 1.2.3.4
port = 9001 //主机1.2.3.4supervisor的web端口

[node:test01]
username = test02
password = test02
host = 4.5.6.7
port = 9001

[environment:cesi_test]
members = test01,test02

[cesi]
database = /home/cesi/userinfo.db
activity_log = /var/log/cesi.log
host = 0.0.0.0

用supervisor运行cesi,配置文件如下:
[root@test supervisord.d]# cat /etc/supervisord.d/cesi.ini
[program:cesi]
directory = /home/cesi/cesi/
command = python web.py
autostart = true
startsecs = 5
autorestart = true
startretries = 3
user = root
redirect_stderr = true
stdout_logfile = /var/log/cesi1.log

启动cesi:
[root@test supervisord.d]# supervisorctl -c /etc/supervisord.conf reload //重新载入配置文件
Restarted supervisord
[root@test supervisord.d]# supervisorctl -c /etc/supervisord.conf status
cesi BACKOFF Exited too quickly (process log may have details)
tomcat RUNNING pid 22590, uptime 0:00:05
[root@test log]# supervisorctl start cesi //启动cesi服务
[root@test log]# supervisorctl status
cesi RUNNING pid 22732, uptime 0:00:30
tomcat RUNNING pid 22590, uptime 0:07:39
默认账号密码:admin,admin,记得一定要修改(web页面右上角修改密码).也可以直接在上面的步骤中修改/home/cesi/userinfo.sql这个sql语句,直接先将密码改掉.cesi默认端口是5000.
web界面如下:

可在web页面直接重启受管理机器的相关服务.

Be First to Comment

发表评论

电子邮件地址不会被公开。 必填项已用*标注