• Stars
    star
    184
  • Rank 209,187 (Top 5 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Centralized supervisor WebUI and CLI

Multivisor

multivisor web on chrome desktop app

Multivisor Python Versions Pypi status License Build Status

A centralized supervisor UI (Web & CLI)

  • Processes status always up to date
  • Reactivity through asynchronous actions
  • Notifications when state changes
  • Mobile aware, SPA web page
  • Powerful filters
  • Interactive CLI
  • works on supervisor and supervisor-win

Multivisor is comprised of 3 components:

  1. web server: gathers information from all supervisors and provides a dashboard like UI to the entire system
  2. multivisor RPC: an RPC extension to supervisor used to communicate between each supervisord and multivisor web server
  3. CLI: an optional CLI which communicates with multivisor web server

Installation and configuration

The installation and configuration steps are exactly the same on Linux and Windows.

Thanks to the ESRF sponsorship, multivisor is able to work well with supervisor-win.

RPC

The multivisor RPC must be installed in the same environment(s) as your supervisord instances. It can be installed on python environments ranging from 2.7 to 3.x.

From within the same python environment as your supervisord process, type:

pip install multivisor[rpc]

There are two options to configure multivisor RPC: 1) as an extra rpcinterface to supervisord or 2) an eventlistener process managed by supervisord.

The first option has the advantage of not requiring an extra process but it's implementation relies on internal supervisord details. Therefore, the multivisor author recommends using the 2nd approach.

Option 1: rpcinterface

Configure the multivisor rpc interface by adding the following lines to your supervisord.conf:

[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=*:9002

If no bind is given, it defaults to *:9002.

Repeat the above procedure for every supervisor you have running.

Option 2: eventlistener

Configure the multivisor rpc interface by adding the following lines to your supervisord.conf:

[eventlistener:multivisor-rpc]
command=multivisor-rpc --bind 0:9002
events=PROCESS_STATE,SUPERVISOR_STATE_CHANGE

If no bind is given, it defaults to *:9002.

You are free to choose the event listener name. As a convention we propose multivisor-rpc.

NB: Make sure that multivisor-rpc command is accessible or provide full PATH.

Repeat the above procedure for every supervisor you have running.

Web server

The multivisor web server requires a python 3.x environment. It must be installed on a machine with a network access to the different supervisors. This is achieved with:

pip install multivisor[web]

The web server is configured with a INI like configuration file (much like supervisor itself) that is passed as command line argument. It is usually named multivisor.conf but can be any filename you which.

The file consists of a global section where you can give an optional name to your multivisor instance (default is multivisor. This name will appear on the top left corner of multivisor the web page).

To add a new supervisor to the list simply add a section [supervisor:<name>]. It accepts an optional url in the format [<host>][:<port>]. The default is <name>:9002.

Here is an example:

[global]
name=ACME

[supervisor:roadrunner]
# since no url is given it will be roadrunner:9002

[supervisor:coyote]
# no host is given: defaults to coyote
url=:9011

[supervisor:bugsbunny]
# no port is given: defaults to 9002
url=bugsbunny.acme.org

[supervisor:daffyduck]
url=daffyduck.acme.org:9007

multivisor web on mobile

Once installed and configured, the web server can be started from the command line with:

multivisor -c ./multivisor.conf

Start a browser pointing to localhost:22000. On a mobile device it should look something like the figure on the right.

Of course the multivisor web server itself can be configured in supervisor as a normal program.

Authentication

To protect multivisor from unwanted access, you can enable authentication.

Specify username and password parameters in global section of your configuration file e.g.:

[global]
username=test
password=test

You can also specify password as SHA-1 hash in hex, with {SHA} prefix: e.g. {SHA}a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 (example hash is test in SHA-1).

In order to use authentication, you also need to set MULTIVISOR_SECRET_KEY environmental variable, as flask sessions module needs some secret value to create secure session. You can generate some random hash easily using python: python -c 'import os; import binascii; print(binascii.hexlify(os.urandom(32)))'

CLI

The multivisor CLI is an optional component which can be installed with:

pip install multivisor[cli]

The CLI connects directly to the web server using an HTTP REST API. It doesn't require any configuration.

It can be started with:

multivisor-cli --url localhost:22000

CLI in action

Running the docker demo

$ docker-compose build --parallel
$ docker-compose up

That's it!

Start a browser pointing to localhost:22000.

Running the example from scratch

# Fetch the project:
git clone https://github.com/tiagocoutinho/multivisor
cd multivisor


# Install frontend dependencies
npm install
# Build for production with minification
npm run build

# feel free to use your favorite python virtual environment
# here. Otherwise you will need administrative privileges
pip install .[all]

# Launch a few supervisors
mkdir examples/full_example/log
supervisord -c examples/full_example/supervisord_lid001.conf
supervisord -c examples/full_example/supervisord_lid002.conf
supervisord -c examples/full_example/supervisord_baslid001.conf

# Finally, launch multivisor:
multivisor -c examples/full_example/multivisor.conf

That's it!

Start a browser pointing to localhost:22000. On a mobile device it should look something like this:

multivisor on mobile

Technologies

multivisor diagram

The multivisor backend runs a flask web server.

The multivisor-cli runs a prompt-toolkit based console.

The frontend is based on vue + vuex + vuetify.

Development

Build & Install

# install frontend
npm install

# build for production with minification
npm run build

# install backend
pip install -e .

Run

# serve at localhost:22000
multivisor -c multivisor.conf

Start a browser pointing to localhost:22000

Development mode

You can run the backend using the webpack dev server to facilitate your development cycle:

First, start multivisor (which listens on 22000 by default):

python -m multivisor.server.web -c multivisor.conf

Now, in another console, run the webpack dev server (it will transfer the requests between the browser and multivisor):

npm run dev

That's it. If you modify App.vue for example, you should see the changes directly on your browser.

More Repositories

1

qredis

Redis GUI using Qt & Python
Python
70
star
2

modbus-proxy

Connect multiple clients to modbus devices
Python
70
star
3

v4l2py

V4L2 python library
Python
65
star
4

linuxpy

Human friendly interface to linux subsystems using python
Python
26
star
5

sinstruments

Simulate any equipment (multimeter, oscilloscope, detectors, motors) over tcp, udp or serial line
Python
24
star
6

us2n

micropython bridge between UART and TCP for the ESP32
Python
20
star
7

modbus-proxy-rs

Rust version of python https://github.com/tiagocoutinho/modbus-proxy server
Rust
14
star
8

gtools

gevent tools
Python
13
star
9

hamamatsu

Python library for hamamatsu detectors (lima plugin included)
Python
11
star
10

sockio

Concurrency agnostic socket with semantics
Python
11
star
11

ser2sock

serial line to socket bridge (so far only tcp)
Python
10
star
12

async_modbus

Async python modbus client library
Python
9
star
13

serialio

Concurreny agnostic serial line communication in python
Python
6
star
14

scpi-protocol

Python sans I/O SCPI protocol parser library
Python
6
star
15

gepace

GEPace 1000/5000/6000 python library + simulator + tango device server
Python
6
star
16

ptwinrm

winrm console based on python prompt toolkit and pywinrm
Python
5
star
17

julabo

Python library to control Julabo equipment
Python
5
star
18

pylonctl

Basler command line tool
Python
5
star
19

netstring

Pure python netstring protocol
Python
4
star
20

cryocon

CryoCon temperature controller: python library + simulator + tango server
Python
3
star
21

connio

Concurrency agnostic python low level transport library (serial line; TCP)
Python
3
star
22

gserial

gevent friendly serial line
Python
3
star
23

xia-pfcu

XIA PFCU python library with optional simulator and tango device
Python
3
star
24

motorlib

A simple motor motion/trajectory simulation python library.
Python
3
star
25

python-tnetstring

Pure python tnetstring encoding
Python
2
star
26

eiger-simulator

Simulate dectris eiger detector
Python
2
star
27

gocomics

downloader of gocomics comics
Python
2
star
28

calvin-hobbes

downloader of calvin and hobbes comics
Python
2
star
29

enjoy

Pure python, concurrency agnostic, access to linux input system. Useful for controlling game pads, joysticks
Python
2
star
30

xkcd

downloader of xkcd comics
Python
1
star
31

beacon

Python
1
star
32

powerbar

Text based bars for python
Python
1
star
33

garfield

downloader of garfield comics
Python
1
star
34

youtube-dl

Python
1
star
35

awesome-control-systems

A curated list of awesome control system resources
1
star
36

dotfiles

My personal dotfiles
Emacs Lisp
1
star
37

progbar

python experiments with progress bars
Python
1
star
38

vacuubrand

python library control basic features of a Vacuubrand controller (DCP 3000)
Python
1
star
39

Tango-cython

Python binding to Tango C++ based on cython
Python
1
star
40

mythen-dcs

Mythen2 DCS python library
Python
1
star
41

tango-doc

Tango documentation project
Python
1
star
42

lima-toolbox

A box of tools to support Lima.
Python
1
star