Skip to content

Maxlab/systemmonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Legion System Monitor Suite

Advanced hardware monitoring tools specifically designed for Lenovo Legion 5 Pro gaming laptops

Python License Hardware GPU

๐ŸŽฏ Purpose

Diagnose and monitor Lenovo Legion 5 Pro screen disconnection issues through comprehensive hardware monitoring, specifically targeting thermal throttling and GPU stability problems that cause display disconnections during gaming sessions.

๐Ÿš€ Quick Start

# Clone the repository
git clone https://github.com/Maxlab/systemmonitor.git
cd systemmonitor

# Run the enhanced Legion monitor
python3 enhanced_legion_monitor.py

# Or use the interactive launcher
chmod +x start_monitor.sh
./start_monitor.sh

๐Ÿ“Š Features

๐Ÿ”ฅ Advanced Temperature Monitoring

  • Multi-source CPU monitoring: lm-sensors, thermal zones, direct hwmon access
  • Direct k10temp access for AMD Ryzen 7 5800H
  • NVMe SSD temperature monitoring with critical threshold parsing
  • Hardware-defined critical temperatures from system files

๐ŸŽฎ Comprehensive GPU Analytics

  • Multi-method GPU detection: nvidia-smi, proc files, lspci validation
  • RTX 3070 Mobile optimization with throttling detection
  • Driver version reporting and compatibility checking
  • Safe parsing of GPU metrics with graceful fallback

โšก Power System Monitoring

  • Battery voltage monitoring with AC/battery status detection
  • Power delivery analysis for mobile gaming platform
  • Charging status and power source identification

๐Ÿ–ฅ๏ธ Beautiful Terminal Interface

โ”Œโ”€ LEGION 5 PRO FULL MONITOR v6.0 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ”ฅ CPU (AMD Ryzen 7 5800H): 52.3ยฐC (Critical: 90ยฐC) - k10temp      โ”‚
โ”‚ ๐ŸŽฎ GPU (RTX 3070 Laptop): 48.1ยฐC - Driver: 525.60.11              โ”‚  
โ”‚ ๐Ÿ’พ NVMe SSD: 45.2ยฐC (Critical: 85ยฐC) - hwmon2                      โ”‚
โ”‚ โšก Power: 19.2V (AC Connected) - Battery: 95%                       โ”‚
โ”‚ ๐Ÿ“Š Memory: 15.2GB/32GB (47%) โ”‚ ๐Ÿ’ฟ Disk: 245GB/512GB (48%)         โ”‚
โ”‚ ๐Ÿšจ Alerts: 0 โ”‚ โฑ๏ธ  Runtime: 00:15:32 โ”‚ ๐Ÿ“ˆ Samples: 468           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Installation

Prerequisites

  • Python 3.7+
  • Linux (tested on Ubuntu 24.04+)
  • Lenovo Legion 5 Pro (optimal) or compatible hardware

Dependencies

Dependencies are automatically installed when you run the script:

  • psutil - System and process utilities
  • colorama - Terminal color support

Manual Installation

pip3 install psutil colorama

๐Ÿ“– Usage

Enhanced Legion Monitor

# Basic monitoring
python3 enhanced_legion_monitor.py --export json

# With custom thresholds
python3 enhanced_legion_monitor.py --cpu-temp 85 --gpu-temp 80 --disk-usage 90

# Export data every 30 seconds
python3 enhanced_legion_monitor.py --interval 30 --export-interval 30

Interactive Launcher

./start_monitor.sh

Choose from 5 preset configurations:

  1. Gaming Mode - High thresholds for gaming sessions
  2. Diagnostic Mode - Sensitive thresholds for problem detection
  3. Stress Test - Extreme thresholds for hardware testing
  4. Silent Mode - Minimal alerts for background monitoring
  5. Custom Mode - User-defined thresholds

๐ŸŽฎ Controls

Key Action
q Quit gracefully with data preservation
s Save current state to all export formats
r Reset alert counters and clear warnings
c Clear screen and refresh display

๐Ÿ“ Export Formats

JSON (Structured Data)

{
  "timestamp": "2024-12-19T16:30:45",
  "cpu": {
    "temperature": 52.3,
    "usage": 23.4,
    "frequency": 3200
  },
  "gpu": {
    "temperature": 48.1,
    "usage": 67.8,
    "memory_used": 4.2,
    "memory_total": 8.0
  }
}

CSV (Time Series)

timestamp,cpu_temp,cpu_usage,gpu_temp,gpu_usage,memory_usage
2024-12-19 16:30:45,52.3,23.4,48.1,67.8,47.2

TXT (Human Readable)

Legion System Monitor Report - 2024-12-19 16:30:45
CPU: 52.3ยฐC (23.4% usage) - Normal
GPU: 48.1ยฐC (67.8% usage) - Normal
Memory: 15.2GB/32GB (47%) - Normal

๐Ÿ—๏ธ Architecture

Enhanced Legion Monitor

  • Hardware-Specific Paths: Direct access to Legion 5 Pro sensors
  • TempReading Dataclass: Structured temperature data with critical thresholds
  • Multi-Method Validation: Redundant hardware detection for reliability
  • Graceful Degradation: Works on non-Legion hardware
  • Multi-threaded Design: Responsive UI with background monitoring
  • Rotating Buffers: Memory-efficient long-term monitoring
  • Production-Ready: Comprehensive error handling and signal management

๐Ÿ”ง Configuration

Command Line Options

--cpu-temp 85          # CPU temperature threshold (ยฐC)
--gpu-temp 80          # GPU temperature threshold (ยฐC)
--memory-usage 80      # Memory usage threshold (%)
--disk-usage 90        # Disk usage threshold (%)
--interval 2           # Monitoring interval (seconds)
--export-interval 300  # Export interval (seconds)

Configuration File

{
  "thresholds": {
    "cpu_temperature": 85,
    "gpu_temperature": 80,
    "memory_usage": 80,
    "disk_usage": 90
  },
  "monitoring": {
    "interval": 2,
    "export_interval": 300,
    "max_history": 300
  },
  "display": {
    "show_graphs": true,
    "color_coding": true,
    "unicode_boxes": true
  }
}

๐ŸŽฏ Legion 5 Pro Optimization

Hardware-Specific Features

  • AMD Ryzen 7 5800H: Direct k10temp sensor access
  • RTX 3070 Mobile: Enhanced throttling detection
  • NVMe SSD: Multi-drive temperature monitoring
  • Battery System: Voltage and power source monitoring

Sensor Paths

CPU Temperature: /sys/class/hwmon/hwmon3/temp1_input
NVMe SSD Temps:  /sys/class/hwmon/hwmon2/temp{1,2,3}_input
Battery Voltage: /sys/class/hwmon/hwmon1/in0_input
Critical Limits: /sys/class/hwmon/hwmon*/temp*_crit

๐Ÿšจ Troubleshooting

Common Issues

No GPU detected

# Check NVIDIA driver installation
nvidia-smi
sudo apt install nvidia-driver-570

Permission denied on sensor files

# Add user to necessary groups
sudo usermod -a -G adm,dialout,plugdev $USER
# Logout and login again

Temperature sensors not found

# Install sensor utilities
sudo apt install lm-sensors
sudo sensors-detect

Screen Disconnection Diagnosis

  1. Monitor thermal throttling:

    python3 enhanced_legion_monitor.py --cpu-temp 80 --gpu-temp 75
  2. Check for power delivery issues:

    • Watch battery voltage during gaming
    • Monitor AC adapter connection status
  3. Validate GPU stability:

    • Check driver version compatibility
    • Monitor GPU temperature and throttling

๐Ÿ“ˆ Performance

System Impact

  • CPU Overhead: <1% (2-second intervals)
  • Memory Usage: ~50MB with 300-sample history
  • Startup Time: <2 seconds including hardware discovery
  • Response Time: Instant keyboard controls via threading

Monitoring Capabilities

  • Temperature Accuracy: ยฑ1ยฐC with direct sensor access
  • Update Frequency: Real-time (configurable 1-10 second intervals)
  • History Retention: 300 samples (configurable)
  • Export Efficiency: Batched writes with minimal I/O impact

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Setup

git clone https://github.com/Maxlab/systemmonitor.git
cd systemmonitor
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

๐Ÿ“‹ Requirements

Hardware Requirements

  • Recommended: Lenovo Legion 5 Pro (AMD Ryzen 7 5800H + RTX 3070)
  • Minimum: Any Linux system with temperature sensors
  • GPU: NVIDIA GPU with nvidia-smi support (optional)

Software Requirements

  • OS: Linux (Ubuntu 20.04+ recommended)
  • Python: 3.7 or higher
  • Dependencies: psutil, colorama (auto-installed)

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Lenovo for Legion 5 Pro hardware specifications
  • NVIDIA for GPU monitoring APIs
  • Linux hwmon subsystem for sensor access
  • Python community for excellent monitoring libraries

๐Ÿ“ž Support


๐ŸŽฎ Built for gamers, by gamers. Keep your Legion cool! ๐Ÿ”ฅ

About

Lenovo Legion Pro System Monitor Suite

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages