Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stylesuxx/clientmonitor
Collect client data and display on monitor
https://github.com/stylesuxx/clientmonitor
Last synced: about 1 month ago
JSON representation
Collect client data and display on monitor
- Host: GitHub
- URL: https://github.com/stylesuxx/clientmonitor
- Owner: stylesuxx
- License: mit
- Created: 2024-08-05T21:59:37.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-08-05T22:30:37.000Z (3 months ago)
- Last Synced: 2024-10-07T02:17:25.154Z (about 1 month ago)
- Language: Python
- Homepage: https://pypi.org/project/clientmonitor/
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Multi process monitor
This is a small helper library intended for monitoring multiple processes outputting the same data set, visualizing it in a ncurses table.
> Example: Multiple scrapers processing different URLs logging their progress to one central monitoring entity.
## Installation
```bash
pip install clientmonitor
```## Usage
This library consists of a server and a client. The Server accepts connections from clients and prints data received from the clients.The clients expect the server to be running before connecting.
### Running the server
Port and secret are mandatory, host is optional and only relevant if server and client are not being run on the same machine.```python
from clientmonitor.Server import Serverserver = Server(6666, "secret", host="localhost")
server.set_columns([
{
"key": "key1",
"label": "Label for Key 1"
},
{
"key": "key2",
"label": "Label for Key 2"
}
])
server.start()# CTRL-C to stop
```The columns being set are the columns that are expected to be received as data from the clients and are what the server will print.
### Running the client
```python
import time
from clientmonitor.Client import Clientclient = Client("client-1", 6666, "secret")
client.connect()for i in range(0, 5):
client.send({
"key1": 100 + i,
"key2": 200 + i,
})time.sleep(5)
client.close()
```## Development
Pull request are welcome, pleas address them against the develop branch.### Publish
```bash
python -m build
python3 -m twine upload --repository testpypi dist/*
```