Performance Monitor
Real-time system performance monitoring and analysis tool with interactive dashboard and comprehensive reporting.
Performance Monitoring Tool
A comprehensive performance monitoring system that provides real-time monitoring, reporting, and analysis capabilities for Linux and macOS systems.
Features
System Monitoring
- CPU usage and temperature monitoring
- Memory usage and swap monitoring
- Disk I/O and space monitoring
- Network traffic and connection monitoring
- Process monitoring and management
- Service performance tracking
Performance Metrics
- Detailed CPU metrics:
- Usage percentage
- Temperature
- Frequency
- Load average
- Top CPU-consuming processes
- Memory metrics:
- Total and used memory
- Swap usage
- Memory pressure
- Top memory-consuming processes
- Disk metrics:
- Space utilization
- I/O operations
- Read/write speeds
- Inode usage
- Network metrics:
- Interface statistics
- Connection tracking
- Traffic analysis
- Top network connections
Reporting
- HTML reports with interactive charts
- JSON reports for programmatic analysis
- Historical data tracking
- Customizable report intervals
- Process and service performance reports
Interactive Dashboard
- Real-time system metrics visualization
- Responsive web interface
- Auto-updating charts and tables
- Customizable port and host settings
- Mobile-friendly design
Cross-Platform Support
- Linux (RHEL, Debian, and variants)
- macOS
- Consistent metrics collection across platforms
- Platform-specific optimizations
Installation
Prerequisites
- Bash shell
- Python 3 (for dashboard)
- jq (for JSON processing)
- yq (for YAML processing, optional)
Installation Steps
Download the script from the Lambda Softworks Customer Portal:
- Log in to your Lambda Softworks Customer Portal account
- Navigate to the Files section
- Download the performance.sh script
Make the script executable:
chmod +x performance.sh
- Install dependencies:
For Debian/Ubuntu:
sudo apt-get update sudo apt-get install -y python3 jq sysstat
For RHEL/CentOS:
sudo yum install -y python3 jq sysstat
For macOS:
brew install python3 jq
- Create configuration file (optional):
mkdir -p ~/.config/performance cat > ~/.config/performance/config.yml << EOF interval: 60 # Monitoring interval in seconds threshold: 80 # Alert threshold percentage dashboard_port: 8080 # Dashboard port number dashboard_host: "0.0.0.0" # Dashboard host address EOF
Usage
Basic Usage
- Start monitoring:
./performance.sh --monitor
- Generate HTML report:
./performance.sh --report html
- Start interactive dashboard:
./performance.sh --dashboard 8080
Advanced Usage
- Monitor with custom interval and threshold:
./performance.sh --monitor 30 85
- Generate JSON report:
./performance.sh --report json
- Use custom configuration file:
./performance.sh --config /path/to/config.yml --monitor
Command Line Options
--monitor [interval] [threshold]
: Start monitoring with optional interval and threshold--report [html|json]
: Generate performance report--dashboard [port]
: Start interactive dashboard--config FILE
: Use custom configuration file--help
: Show help message
Configuration
Configuration File Location
- Default:
~/.config/performance/config.yml
- Custom: Specified via
--config
option
Configuration Options
# Monitoring settings interval: 60 # Monitoring interval in seconds threshold: 80 # Alert threshold percentage # Dashboard settings dashboard_port: 8080 # Dashboard port number dashboard_host: "0.0.0.0" # Dashboard host address # Report settings report_format: "html" # Default report format chart_theme: "light" # Chart theme (light/dark)
Logs and Data Storage
Log File Location
- Linux:
~/.local/log/performance.log
- macOS:
~/Library/Logs/performance.log
Metrics Storage
- Location:
~/.local/share/performance/metrics/
- Format: JSON files with timestamps
- Retention: Configurable (default: 7 days)
Reports Storage
- Location:
~/.local/share/performance/reports/
- Format: HTML and JSON files
- Retention: Configurable (default: 90 days)
Cross-Platform Compatibility
Linux Support
- RHEL/CentOS 7+
- Ubuntu 18.04+
- Debian 10+
- Other Linux distributions with systemd
macOS Support
- macOS 10.15+
- Intel and Apple Silicon Macs
- Native macOS services support
Examples
Basic Monitoring
# Start monitoring with default settings ./performance.sh --monitor # Monitor with custom interval (30s) and threshold (85%) ./performance.sh --monitor 30 85
Report Generation
# Generate HTML report ./performance.sh --report html # Generate JSON report ./performance.sh --report json
Dashboard Usage
# Start dashboard on default port (8080) ./performance.sh --dashboard # Start dashboard on custom port ./performance.sh --dashboard 9090
Custom Configuration
# Use custom config file ./performance.sh --config /path/to/config.yml --monitor
Troubleshooting
Common Issues
Permission Errors
- Ensure the script is run with sudo
- Check directory permissions
- Verify user has necessary privileges
Service Optimization Issues
- Verify service names in configuration
- Check systemd service status
- Review service logs
Report Generation Issues
- Check log directory permissions
- Verify HTML template access
- Check disk space
Debug Mode
To enable debug logging:
sudo DEBUG=1 ./performance.sh [OPTIONS]