zoukankan      html  css  js  c++  java
  • 【Linux】类Unix 操作系统进程监控控制工具 Supervisor

    Supervisor 是一个客户端服务器系统,允许用户监控和控制类 Unix 操作系统上的进程数。

    官网 http://supervisord.org

    安装
    1. easy_install supervisor
    2.
    setuptools (latest) from http://pypi.python.org/pypi/setuptools.
    meld3 (latest) from http://www.plope.com/software/meld3/.
    elementtree (latest) from http://effbot.org/downloads#elementtree.

    建立配置文件
    echo_supervisord_conf > /etc/supervisord.conf
    指定配置文件
    supervisord -c supervisord.conf


    查找配置文件路经
    -c 指定配置文件
    无指定配置文件时,查找顺序:
    1 $CWD/supervisord.conf
    2 $CWD/etc/supervisord.conf
    3 /etc/supervisord.conf


    配置文件说明

    HTTP/XML-RPC 相关配置
    [unix_http_server]
    file = /tmp/supervisor.sock
    chmod = 0777
    chown= nobody:nogroup
    username = user
    password = 123

    Web管理界面配置
    [inet_http_server]
    port = 127.0.0.1:9001
    username = user
    password = 123

    [supervisorctl]
    serverurl = unix:///tmp/supervisor.sock 和[unix_http_server]匹配
    username = chris
    password = 123
    prompt = mysupervisor


    日志 环境等配置
    [supervisord]
    logfile = /tmp/supervisord.log
    logfile_maxbytes = 50MB
    logfile_backups=10
    loglevel = info
    pidfile = /tmp/supervisord.pid
    nodaemon = false
    minfds = 1024
    minprocs = 200
    umask = 022
    user = chrism
    identifier = supervisor
    directory = /tmp
    nocleanup = true
    childlogdir = /tmp
    strip_ansi = false
    environment = KEY1="value1",KEY2="value2"

    配置单个进程
    [program:theprogramname]
    command=/bin/cat ; the program (relative uses PATH, can take args)
    process_name=%(program_name)s ; process_name expr (default %(program_name)s)
    numprocs=1 ; number of processes copies to start (def 1)
    directory=/tmp ; directory to cwd to before exec (def no cwd)
    umask=022 ; umask for process (default None)
    priority=999 ; the relative start priority (default 999)
    autostart=true ; start at supervisord start (default: true)
    autorestart=unexpected ; whether/when to restart (default: unexpected)
    startsecs=1 ; number of secs prog must stay running (def. 1)
    startretries=3 ; max # of serial start failures (default 3)
    exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
    stopsignal=QUIT ; signal used to kill process (default TERM)
    stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
    stopasgroup=false ; send stop signal to the UNIX process group (default false)
    killasgroup=false ; SIGKILL the UNIX process group (def false)
    user=chrism ; setuid to this UNIX account to run the program
    redirect_stderr=true ; redirect proc stderr to stdout (default false)
    stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
    stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
    stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
    stdout_events_enabled=false ; emit events on stdout writes (default false)
    stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
    stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
    stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
    stderr_events_enabled=false ; emit events on stderr writes (default false)
    environment=A="1",B="2" ; process environment additions (def no adds)
    serverurl=AUTO ; override serverurl computation (childutils)

    另外配置还有
    [fcgi-program:x]

    [eventlistener:x]

    [rpcinterface:x]

    包含指定的配置文件
    [include]
    files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf

  • 相关阅读:
    UML中常用的几种图
    JVM调优问题与总结
    可视化算法学习网站
    [MacOS]查看端口占用进程
    [MacOS]停止"访达"操作,然后再次尝试推出磁盘
    [MacOS]蓝牙重置
    [CentOS7]扩充swap空间
    [5500V5]开启snmpv2
    [Cisco]MDS 9148S 开启snmp v2
    [CentOS7]测试udp端口
  • 原文地址:https://www.cnblogs.com/abeen/p/4466273.html
Copyright © 2011-2022 走看看