Supervisor 、Supervisord-Monitor 的web统一管理安装、配置、使用

Supervisor: A Process Control System

说明:[http://supervisord.org/]Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

Supervisor使用python开发的一个c/s服务,linux下进程管理系统、监听、重启、停止进程。Server supervisord,supervisorctl作为客户端管理进程。


一、 安装

1、yum 安装: yum install supervisor

2、easy_install 安装:wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O |python && easy_install supervisor

3、salt stack安装:

15d76b260f4fb283518c976de91f79c296be524a


init.sls

{% if grains['osmajorrelease'] == "6" %}

supervisor_install:

cmd.run:

- name: yum install python python-meld3 -y && rpm -Uvh http://****/supervisor-3.0-1.gf.el6.noarch.rpm

{% elif grains['osmajorrelease'] == "7" %}

supervisor:

pkg:

- installed

{% endif %}

/etc/supervisord.d/:

file.directory:

- makedirs: True

- mode: 755

/etc/supervisord.conf:

file.managed:

- source: salt://supervisord/files/supervisord.conf

- backup: minion

- template: jinja

/etc/supervisord.d/templet.ini:

file.managed:

- source: salt://supervisord/files/templet.ini

supervisord:

service.running:

- watch:

- file: /etc/supervisord.conf

- reload: True

- enable: True


salt安装:salt “*” state.sls supervisord

supervisor安装完成后,会生成supervisord(supervisor守护进程)、supervisorctl(客户端)、echo_supervisord_conf(生成配置文件),


二、 配置文件

cat /etc/supervisord.conf

[unix_http_server]

file=/var/tmp/supervisor.sock ;socket 文件,supervisorctl 会使用

[inet_http_server]

port=ip:9001 ;Web管理后台运行的IP和端口,建议监听内网ip

[supervisord]

logfile=/var/log/supervisor/supervisord.log

logfile_maxbytes=50MB ;日志文件大小,超出会rotate,默认 50MB,如果设成0,表示不限制大小

logfile_backups=10 ;日志文件保留备份数量默认10,设为0表示不备份

loglevel=info

pidfile=/var/run/supervisord.pid

nodaemon=false

minfds=1024

minprocs=200

[rpcinterface:supervisor]

supervisor.rpcinterface_factory

[supervisorctl]

serverurl=http://ip:9001

[include]

files = supervisord.d/*.ini

cat /etc/supervisord.d/templet.ini (进程模版,来自saltstack)

;[program:templet]

;command=/www/webcode/templet/bin/catalina.sh run

;user=appuser

;autostart=true

;autorestart=true

;startretries=3

;stopsignal=QUIT

;stopasgroup=true

;killasgroup=true

;stdout_logfile=/www/webcode/templet/logs/catalina.out

;redirect_stderr=true

;environment=JAVA_HOME=/opt/java

;stdout_capture_maxbytes=1024MB

;stdout_events_enabled=true

具体见:http://supervisord.org/configuration.html


三、 启动supervisor:

supervisord -c /etc/supervisord.conf

systemctl start supervisord

/etc/init.d/supervisord start

四、 supervisorctl使用

通过supervisorctl对进程进行管理:

supervisorctl help

79c8c6ee8678534f49278ea48d5b135f1709abcf

五、 Web管理:地址见配置文件

http://localip:9001,可以进行进程的重启,日志查看等操作

a1950a0876fe5f272679317f80ba6c23df6aa35d

六、 多主机统一管理:

官方推荐:http://supervisord.org/plugins.html

cesiWeb-based dashboard written in Python.

Django-DashvisorWeb-based dashboard written in Python. Requires Django 1.3 or 1.4.

NodervisorWeb-based dashboard written in Node.js.

Supervisord-MonitorWeb-based dashboard written in PHP.

SupervisorUIAnother Web-based dashboard written in PHP.

supervisorclusterctlCommand line tool for controlling multiple Supervisor instances using Ansible.

suponoffWeb-based dashboard written in Python 3. Requires Django 1.7 or later.

SupvisorsDesigned for distributed applications, written in Python 2.7. Includes an extended XML-RPC API and a Web-based dashboard.

目前我们自己使用Supervisord-Monitor,可以通过dash来管理不同服务器上Supervisord程,重启、停止、日志看等。具体截如下:

dcc8415773c3fb0137998fe1f80f389b6dfa9be5

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值