Simplistic system monitor based on psutils with a dedicated http endpoint.
It was initially developed on Windows 10 Pro with PyCharm 2022.3.1 (Community Edition) and Python 3.11.
To configure and run this project, follow this README.md regarding the Python configuration and the virtualenv use.
To start the monitoring service
- Clone the repository
- Update Python (if older than 3.11)
- Initialize venv and run the
system_monitor.pyscript. It will start the monitoring service and serve the data via a http server.
- default HTTP listen port
- 7197 (variable MONITOR_PORT located in config/conf.py)
- GET endpoint
- /node/system/status (variable MONITORING_ENDPOINT located in config/conf.py)
To change the monitored directory, set the required value to a variable:
- DEFAULT_PATH located in config/conf.py (currently it should be set either to ~/.ethereum or ~/.lighthouse).
psutilwill query the partition on which the specified directory is located
How to install (Ubuntu):
- Prerequisites
- Monitor
cd APPROPRIATE_DIRECTORY
git clone https://github.com/Web3-Pi/basic-system-monitor.git
cd basic-system-monitor
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
deactivate- If there are problems during venv creation, install required package:
sudo apt install python3.11-venv- If during the installation of requirements there is a problem with
psutils, run this command to install the required packages (and then, install the requirements):
sudo apt-get install gcc python3-dev libpython3.11-devTo run the service, follow the steps below:
cd APPROPRIATE_DIRECTORY/basic-system-monitor
source venv/bin/activate
python3 system_monitor.py # Ctrl-c to shut down the monitor
deactivateCommand line parameters accepted by the script:
usage: system_monitor.py [-h] [-p PORT]
A simple monitoring tool with a HTTP endpoint
options:
-h, --help show this help message and exit
-p PORT, --port PORT HTTP server listen port (default: 7197)
To run the service from an automatically created screen session named monitor, use this script (may be called start_monitor.sh) - it assumes that monitor is located in /home/ethereum/dev/basic-system-monitor directory:
screen -S monitor -dm bash -c 'cd /home/ethereum/dev/basic-system-monitor;source venv/bin/activate;python3 system_monitor.py;deactivate'Querying data locally:
curl -i -H "Accept: application/json" -X GET http://127.0.0.1:7197/node/system/statusQuerying myhost.local in a local network:
curl -i -H "Accept: application/json" -X GET http://myhost.local:7197/node/system/status