zoukankan      html  css  js  c++  java
  • supervisor运行virtualenv环境下的nagios-api

    supervisord-example.conf

    [unix_http_server]
    file=/tmp/supervisor.sock                       ; path to your socket file
    
    [supervisord]
    logfile=/var/log/supervisord/supervisord.log    ; supervisord log file
    logfile_maxbytes=50MB                           ; maximum size of logfile before rotation
    logfile_backups=10                              ; number of backed up logfiles
    loglevel=error                                  ; info, debug, warn, trace
    pidfile=/var/run/supervisord.pid                ; pidfile location
    nodaemon=false                                  ; run supervisord as a daemon
    minfds=1024                                     ; number of startup file descriptors
    minprocs=200                                    ; number of process descriptors
    user=root                                       ; default user
    childlogdir=/var/log/supervisord/               ; where child log files will live
    
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock         ; use a unix:// URL  for a unix socket
    
    ; This is where you run individual Tornado instances.
    ; We run four; one per processor core.
    ; In development, we ran as many as four per core with no issues.
    ; If you're looking to minimize cpu load, run fewer processes.
    ; BTW, Tornado processes are single threaded.
    ; To take advantage of multiple cores, you'll need multiple processes.
    
    [program:tornado-8001]
    directory=/var/www/Server/
    environment=PATH="/var/www/Server/venv/bin"
    command=/var/www/Server/venv/bin/python -m tornado_api.application --port=8001
    stderr_logfile = /var/log/supervisord/tornado-stderr.log
    stdout_logfile = /var/log/supervisord/tornado-stdout.log
    
    [program:tornado-8002]
    directory=/var/www/Server/
    environment=PATH="/var/www/Server/venv/bin"
    command=/var/www/Server/venv/bin/python -m tornado_api.application --port=8002
    stderr_logfile = /var/log/supervisord/tornado-stderr.log
    stdout_logfile = /var/log/supervisord/tornado-stdout.log
    
    ; Run celery process with supervisord
    [program:celery]
    directory=/var/www/Server/celery_workers
    environment=PATH="/var/www/Server/venv/bin"
    command=/var/www/Server/venv/bin/celery -A tasks worker --loglevel=info
    stderr_logfile = /var/log/supervisord/celery-stderr.log
    stdout_logfile = /var/log/supervisord/celery-stdout.log
    

    centos7 环境

    yum install -y supervisor
    
    cat > /etc/supervisord.d/nagios-api.ini << EOF
    [program:nagios-api]
    directory=/opt/nagios-api/
    environment=PATH="/opt/nagios-api/venv/bin"
    command=/opt/nagios-api/venv/bin/python nagios-api -p 8080 -c /var/spool/nagios/cmd/nagios.cmd -s /var/log/nagios/status.dat -l /var/log/nagios/nagios.log
    
    stdout_logfile=/var/log/supervisor/nagios-api.log
    stdout_logfile_maxbytes=1MB
    stderr_logfile=/var/log/supervisor/nagios-api.error_log
    stderr_logfile_maxbytes=1MB
    EOF
    
    systemctl restart supervisord
    
  • 相关阅读:
    公号文章模板
    css 网格线
    刷题笔记-图-图的存储
    PAT Advanced A1021 Deepest Root (25) [图的遍历,DFS,计算连通分量的个数,BFS,并查集]
    PAT Advanced 1013 Battle Over Cities (25) [图的遍历,统计连通分量的个数,DFS,BFS,并查集]
    PAT Advanced 1076 Forwards on Weibo (30) [图的遍历,BFS,DFS]
    PAT Advanced 1034 Head of a Gang (30) [图的遍历,BFS,DFS,并查集]
    堆排序
    PAT Advanced 1155 Heap Paths (30) [DFS, 深搜回溯,堆]
    PAT Advanced 1098 Insertion or Heap Sort (25) [heap sort(堆排序)]
  • 原文地址:https://www.cnblogs.com/liujitao79/p/7249992.html
Copyright © 2011-2022 走看看