Advanced hardware monitoring tools specifically designed for Lenovo Legion 5 Pro gaming laptops
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.
# 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
- 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
- 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
- Battery voltage monitoring with AC/battery status detection
- Power delivery analysis for mobile gaming platform
- Charging status and power source identification
āā 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 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
- Python 3.7+
- Linux (tested on Ubuntu 24.04+)
- Lenovo Legion 5 Pro (optimal) or compatible hardware
Dependencies are automatically installed when you run the script:
psutil- System and process utilitiescolorama- Terminal color support
pip3 install psutil colorama
# 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
./start_monitor.sh
Choose from 5 preset configurations:
- Gaming Mode - High thresholds for gaming sessions
- Diagnostic Mode - Sensitive thresholds for problem detection
- Stress Test - Extreme thresholds for hardware testing
- Silent Mode - Minimal alerts for background monitoring
- Custom Mode - User-defined thresholds
| 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 |
{
"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
}
}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
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
- 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
--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)
{
"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
}
}- 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
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
No GPU detected
# Check NVIDIA driver installation
nvidia-smi
sudo apt install nvidia-driver-570Permission 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-
Monitor thermal throttling:
python3 enhanced_legion_monitor.py --cpu-temp 80 --gpu-temp 75
-
Check for power delivery issues:
- Watch battery voltage during gaming
- Monitor AC adapter connection status
-
Validate GPU stability:
- Check driver version compatibility
- Monitor GPU temperature and throttling
- 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
- 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
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
git clone https://github.com/Maxlab/systemmonitor.git cd systemmonitor python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
- 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)
- OS: Linux (Ubuntu 20.04+ recommended)
- Python: 3.7 or higher
- Dependencies: psutil, colorama (auto-installed)
This project is licensed under the MIT License - see the LICENSE file for details.
- Lenovo for Legion 5 Pro hardware specifications
- NVIDIA for GPU monitoring APIs
- Linux hwmon subsystem for sensor access
- Python community for excellent monitoring libraries
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Hardware: Tested on Legion 5 Pro (AMD Ryzen 7 5800H + RTX 3070)
š® Built for gamers, by gamers. Keep your Legion cool! š„