Skip to content

A Python script to monitor and display system resource usage, specifically CPU, memory, and network bandwidth. The script continuously updates the system resource statistics in real-time, offering a visual representation of CPU and memory usage, along with network bandwidth usage details.

Notifications You must be signed in to change notification settings

Hillary520/python_system_monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python System Monitor

A high-performance, real-time system monitoring tool with an interactive terminal user interface. Monitor CPU, memory, network, processes, and system information with smooth updates and responsive controls.

Python System Monitor Demo

Features

  • 🚀 Real-time system metrics monitoring
  • 💻 Per-core CPU usage and temperature tracking
  • 🧮 Memory and swap usage visualization
  • 🌐 Network bandwidth monitoring with rate smoothing
  • 📊 Process management with detailed statistics
  • ⚡ Asynchronous architecture for optimal performance
  • 🎯 Interactive process control (kill, sort)
  • 📱 Responsive terminal UI with automatic resizing

Requirements

  • Python 3.12+
  • Linux/Unix-based system

Required packages:

  • psutil>=5.9.0
  • aiofiles>=24.1.0

Installation

  1. Clone the repository:
git clone https://github.com/Hillary520/python_system_monitor.git
cd python_system_monitor
  1. Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

Run the monitor:

python3 run_monitor.py

Controls

  • /: Navigate process list
  • k: Kill selected process
  • q: Quit
  • r: Refresh display
  • F5: Force refresh

Stress Testing

The project includes a stress test script to verify monitoring capabilities:

chmod +x stress_test.sh
./stress_test.sh

Architecture

  • Async Core: Built on Python's asyncio for non-blocking operations
  • Modular Design: Separate monitors for different system aspects
  • Optimized Updates: Variable refresh rates per component
  • Resource Efficient: Minimal CPU/Memory footprint

Project Structure

python_system_monitor/
├── src/
│   └── python_system_monitor/
│       ├── monitors/
│       │   ├── cpu_monitor.py
│       │   ├── memory_monitor.py
│       │   ├── network_monitor.py
│       │   ├── process_monitor.py
│       │   └── system_info.py
│       ├── ui/
│       │   └── ui_handler.py
│       └── main.py
├── stress_test.sh
├── run_monitor.py
├── requirements.txt
└── README.md

Development

To run tests:

pytest tests/ --cov=python_system_monitor

Acknowledgments

About

This project was created to provide a modern, efficient system monitoring solution with a focus on performance and user experience.

About

A Python script to monitor and display system resource usage, specifically CPU, memory, and network bandwidth. The script continuously updates the system resource statistics in real-time, offering a visual representation of CPU and memory usage, along with network bandwidth usage details.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published