A lightweight, modular Python system monitoring tool designed to collect real-time hardware metrics (CPU, RAM, Disk), generate evaluations, export log files, and serve a web interface.
- Real-Time Metric Collection: Monitors CPU usage, RAM utilization, and disk space using
psutil. - Modular Architecture: Clean separation of data collection, visualization, export, and web interface adhering to PEP 8.
- Text & JSON Export: Logs system states as plain text and exports metric snapshots to
.jsonfiles. - Live Web Dashboard: Built-in HTTP server rendering the dashboard template and serving metrics via a
/api/metricsendpoint, polled by the page every few seconds. - Automated Testing: Core module functionality covered via
pytest.
pms_project/
├── modules/
│ ├── __init__.py
│ ├── collector.py # Gathers system metrics (psutil)
│ ├── plotter.py # Data processing & chart payloads
│ ├── exporter.py # Text and JSON log/export handlers
│ └── web_interface.py # Web server & dashboard controller
├── templates/
│ └── test_dashboard.html # HTML/CSS/JS dashboard template
├── test/
│ └── test_pms.py # Automated unit tests
├── main.py # Main application entry point
├── requirements.txt # Dependency list
└── README.md # Project documentation
- Python 3.9 or higher
- Clone or download the repository:
git clone https://github.com/jesajaw/PMS
cd PMS- Create and activate a virtual environment:
python -m venv venv
# Linux/macOS:
source venv/bin/activate
# Windows:
venv\Scripts\activate- Install the dependencies:
pip install -r requirements.txtExecute main.py to start the monitoring loop and the web dashboard:
python main.pyThe dashboard is then reachable at http://127.0.0.1:8080.
Verify that all modules function correctly:
pytest| Module | Description |
|---|---|
main.py |
Orchestrates the primary execution flow, starts the web dashboard, and periodically logs metrics. |
modules/collector.py |
Retrieves hardware metrics (CPU, RAM, Disk) using psutil. |
modules/plotter.py |
Handles charting themes and structures metric data payloads. |
modules/exporter.py |
Creates log directories and exports evaluations to .txt and .json files. |
modules/web_interface.py |
Runs the dashboard HTTP server and serves live metric data to the browser. |