安裝Supervisorphp
easy_install supervisor
修改配置html
echo_supervisord_conf > /etc/supervisord.conf vim /etc/supervisord.conf [unix_http_server] file=/var/run/supervisor.sock ; (the path to the socket file) [inet_http_server] port=*:9001 username=admin password=admin [supervisord] logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) [supervisorctl] serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket [include] files = /etc/supervisor/*.conf
添加腳本nginx
vim /etc/supervisor/test.conf [program:foo] command=/bin/cat
啓動Supervisorgit
supervisord -c /etc/supervisord.conf
啓動Supervisorctlgithub
:/home/xxx # supervisorctl foo RUNNING pid 17679, uptime 19:21:08
Nginx配置web
server { listen 80; server_name 服務器IP; location / { proxy_pass http://127.0.0.1:9001/RPC2; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; } }
安裝WEB界面vim
Supervisord Multi Server Monitoring Tool服務器
git clone https://github.com/mlazarov/supervisord-monitor.git cp application/config/supervisor.php.example application/config/supervisor.php vim application/config/supervisor.php <?php // Dashboard columns. 2 or 3 $config['supervisor_cols'] = 2; // Refresh Dashboard every x seconds. 0 to disable $config['refresh'] = 10; // Enable or disable Alarm Sound $config['enable_alarm'] = true; // Show hostname after server name $config['show_host'] = false; $config['supervisor_servers'] = array( '服務器HOSTNAME(顯示用)' => array( 'url' => 'http://服務器IP地址', 'port' => '80', 'username' => 'admin', 'password' => 'admin' ), /* 'server02' => array( 'url' => 'http://server02.app/RPC2', 'port' => '9001' ), 'server03' => array( 'url' => 'http://server03.app/RPC2', 'port' => '9001' ), */ ); // Set timeout connecting to remote supervisord RPC2 interface $config['timeout'] = 3; // Path to Redmine new issue url $config['redmine_url'] = 'http://redmine.url/path_to_new_issue_url'; // Default Redmine assigne ID $config['redmine_assigne_id'] = '69';
配置Nginxapp
server { listen 80; server_name super.com; set $web_root /home/xxx/www/supervisord-monitor-master/public_html; root $web_root; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php; } location ~ /*\.php$ { fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $web_root$fastcgi_script_name; fastcgi_param SCHEME $scheme; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } access_log /usr/local/nginx/logs/xxx.log; error_log /usr/local/nginx/logs/xxx_error.log; }
訪問WEB界面socket
若是要配置多臺Supervisor的監控,只須要對變量進行擴充便可:
$config['supervisor_servers']