A next-level Python tool that arms your team with real-time insights into your Debian server's performance during load or stress tests. This script goes beyond typical industry standards by providing powerful data collection, intuitive data visualization, and a self-contained HTML report.
- 🚀 Performance Monitor
This Performance Monitoring Script is designed to empower you during critical performance or stress tests. By default, the script runs for 15 minutes and collects a snapshot of system metrics every 5 seconds, providing:
- 📊 A console summary with average and peak resource usage
- 📈 A detailed, self-contained HTML report with dynamically generated charts
- 🔍 Comprehensive metrics including CPU, Memory, Disk, Network, and Load averages
- 🔄 Cross-platform data collection using
psutil
(optimized for Debian/Linux) - 📝 Real-time logging of system metrics
- ⚙️ Configurable duration and interval for metric collection
- 📊 Beautiful HTML report with embedded charts
- 🧹 Automatic cleanup of temporary files
-
Python 3.6+
-
System packages:
sudo apt-get update sudo apt-get install python3-pip -y
-
Python dependencies:
pip3 install psutil matplotlib
-
Clone the repository:
git clone https://github.com/yourusername/performance-monitor.git cd performance-monitor
-
Make the script executable:
chmod +x monitor.py
./monitor.py
python3 monitor.py --duration 10 --interval 2
💡 Pro Tip: Launch this script right before starting your performance test for comprehensive metrics during the entire test duration.
Option | Description | Default |
---|---|---|
--duration |
Monitoring duration in minutes | 15 |
--interval |
Data collection interval in seconds | 5 |
The script generates two types of reports:
- Real-time display of average and peak usage metrics
- Instant visibility of system performance
- 📈 Interactive charts for all metrics
- 🔗 Self-contained file with embedded base64 images
- 📅 Timestamp-based naming:
performance_report_YYYYMMDD_HHMMSS.html
Metric | Description |
---|---|
CPU Usage | Line chart showing CPU utilization percentage |
Memory Usage | RAM consumption patterns |
Disk Usage | Storage utilization trends |
Network I/O | Bytes sent/received over time |
Load Average | System load metrics |
Metric | Warning Signs | Potential Issues |
---|---|---|
CPU | > 80% average | CPU contention |
Memory | High swap usage | Memory leaks |
Disk | 100% utilization | I/O bottlenecks |
Network | Sudden spikes | Bandwidth constraints |
Load | Exceeds CPU cores | System overload |
-
Per-Process Monitoring
for proc in psutil.process_iter(): print(proc.name(), proc.cpu_percent())
-
Remote Export
# Example: Export to time-series DB def export_metrics(metrics): # Your export logic here pass
Does it require root privileges?
No, psutil can capture system-wide metrics without root access.What's the performance impact?
Minimal. The script is optimized for low overhead.Can I decrease the sampling interval?
Yes, use --interval 1 for second-by-second monitoring.We welcome contributions! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by rajeshkanaka
💡 Note: Replace placeholder images, usernames, and customize the badges according to your actual repository details.