Supervisor Monitor - Monitor your Supervisor instances

安装Supervisor

easy_install supervisor

修改配置

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

添加脚本

vim /etc/supervisor/test.conf

[program:foo]
command=/bin/cat

启动Supervisor

supervisord -c /etc/supervisord.conf

启动Supervisorctl

:/home/xxx #  supervisorctl 
foo                              RUNNING   pid 17679, uptime 19:21:08

Nginx配置

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界面

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';

配置Nginx

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界面

图片描述

如果要配置多台Supervisor的监控,只需要对变量进行扩充即可:

$config['supervisor_servers']

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值