Skip to content

Repository files navigation

🔍 RustWhy

CILicense: GPL-3.0Rust Version

Unified Linux System Diagnostics – Understand WHY things happen

RustWhy is a comprehensive system diagnostic tool that explains why your Linux system behaves a certain way. It combines 13 specialized diagnostic modules into one powerful CLI, providing actionable insights in plain language.

✨ Features

🔧 Complete Diagnostic Suite

ModuleCommandPurpose
🚀 Boot Analysisrustwhy bootAnalyze boot performance and identify slow services
💻 CPU Diagnosticsrustwhy cpuExplain high CPU usage and top consumers
🧠 Memory Analysisrustwhy memUnderstand memory consumption and identify leaks
💾 Disk Analysisrustwhy diskFind what's consuming disk space
📊 I/O Diagnosticsrustwhy ioIdentify processes causing high disk I/O
🌐 Network Diagnosticsrustwhy netTroubleshoot connectivity and performance issues
🌡️ Temperature Analysisrustwhy tempMonitor system temperatures and thermal throttling
🔊 Fan Diagnosticsrustwhy fanUnderstand fan behavior and correlate with temps
🎮 GPU Analysisrustwhy gpuComprehensive GPU diagnostics (NVIDIA/AMD/Intel)
🔋 Battery Analysisrustwhy battDiagnose battery drain and power consumption
😴 Sleep Diagnosticsrustwhy sleepIdentify sleep/suspend inhibitors
🔌 USB Diagnosticsrustwhy usbTroubleshoot USB device issues
📁 Mount Diagnosticsrustwhy mountDebug filesystem mount problems

🎯 Key Capabilities

  • Plain Language Output: Get explanations you can understand, not just raw data
  • Actionable Recommendations: Receive specific commands and steps to resolve issues
  • Real-time Monitoring: Watch mode for continuous diagnostics (CPU, I/O, fans, temperature, GPU)
  • Multiple Output Formats: Terminal (colored), JSON for scripting
  • Comprehensive Metrics: Detailed breakdowns with thresholds and severity levels
  • Multi-Vendor GPU Support: Automatic detection and monitoring for NVIDIA, AMD, and Intel GPUs
  • Shell Completions: Auto-complete support for Bash, Zsh, Fish, and PowerShell

📦 Installation

From a Release Binary (recommended)

Pre-built x86_64-unknown-linux-gnu binaries are attached to every GitHub release. No Rust toolchain required.

# Download and unpack the latest release
curl -L https://github.com/Ninso112/rustwhy/releases/latest/download/rustwhy-v0.1.0-x86_64-unknown-linux-gnu.tar.gz \
| sudo tar -xz -C /usr/local/bin rustwhy
# Verify
rustwhy --version

From AUR (Arch Linux)

Arch Linux users can install RustWhy from the AUR using their favorite AUR helper:

# Using paru
paru -S rustwhy-git
# Using yay
yay -S rustwhy-git
# Or manually
git clone https://aur.archlinux.org/rustwhy-git.git
cd rustwhy-git
makepkg -sri

From Source

git clone https://github.com/Ninso112/rustwhy.git
cd rustwhy
cargo build --release
sudo cp target/release/rustwhy /usr/local/bin/

With NVIDIA GPU Support

cargo build --release --features nvidia
sudo cp target/release/rustwhy /usr/local/bin/

🚀 Usage

Quick Diagnostics

# Analyze CPU usage
rustwhy cpu
# Detailed memory analysis
rustwhy mem --detailed
# Check why disk is full
rustwhy disk /home --depth 4
# Network diagnostics with custom host
rustwhy net --host google.com
# Check boot performance
rustwhy boot --top 15
# Analyze GPU utilization and temperature
rustwhy gpu

Monitoring Mode

# Live CPU monitoring (updates every 2 seconds)
rustwhy cpu --watch
# Monitor disk I/O with 5-second intervals
rustwhy io --watch --interval 5
# Watch fan speeds and temperatures
rustwhy fan --watch
# Temperature monitoring
rustwhy temp --watch
# GPU monitoring
rustwhy gpu --watch

Advanced Usage

# Run all diagnostics
rustwhy all
# JSON output for scripting/parsing
rustwhy cpu --json
rustwhy all --json
# Verbose output with additional details
rustwhy mem --verbose
# Filter disk analysis
rustwhy disk --large 100M --old 90 # Files >100MB and >90 days old# Check specific USB device
rustwhy usb --device 1234:5678
# Analyze NFS mounts
rustwhy mount --nfs

Shell Completions

# Generate completions for your shell
rustwhy completions bash >~/.local/share/bash-completion/completions/rustwhy
rustwhy completions zsh >~/.zsh/completions/_rustwhy
rustwhy completions fish >~/.config/fish/completions/rustwhy.fish
rustwhy completions powershell > _rustwhy.ps1

Or from the project root: make completions. Generated scripts land in assets/completions/.

📖 Documentation

🔍 Example Output

CPU DIAGNOSTICS
════════════════════════════════════════════════════════════
Overall Status: ✅ OK - CPU usage within normal range
Load Average: 1.23 / 1.45 / 1.67 (1m / 5m / 15m)
CPU Usage: 23.4%
CPU Cores: 8
💡 WHY is this happening?
┌─ Finding: firefox (PID 12345) consuming 8.2% CPU
│ → Memory: 2458240 KB, User: 1000
└─ ℹ️ INFO
┌─ Finding: gnome-shell (PID 1678) consuming 3.1% CPU
│ → Memory: 458240 KB, User: 1000
└─ ℹ️ INFO
📋 RECOMMENDATIONS:
1. [LOW] Monitor CPU usage during peak hours
$ ps aux --sort=-%cpu | head -n 15
→ Keep track of resource-intensive applications

🛠️ Requirements

  • Operating System: Linux (kernel 4.0+)
  • Rust: 1.70 or newer
  • System Access: Some modules require /proc and /sys access
  • Optional:
    • systemd for boot analysis
    • NVIDIA drivers for GPU diagnostics (with --features nvidia)
    • Root access for some advanced diagnostics

🤝 Contributing

Contributions are welcome! Please see our Contributing Guidelines for details.

Quick Start for Contributors

# Clone and build
git clone https://github.com/Ninso112/rustwhy.git
cd rustwhy
cargo build
# Run tests
cargo test# Check formatting and linting
cargo fmt --all -- --check
cargo clippy --all-features -- -D warnings
# Run a module
cargo run -- cpu

📝 License

This project is licensed under the GPL-3.0 License – see the LICENSE file for details.

🙏 Acknowledgments

RustWhy consolidates and reimplements in Rust the functionality of these Python diagnostic tools:

  • bootwhy, cpuwhy, memwhy, diskwhy, iowhy
  • netwhy, fanwhy, tempwhy, gpuwhy
  • battwhy, sleepwhy, usbwhy, mountwhy

🌟 Star History

If you find RustWhy useful, please consider giving it a star on GitHub!

📮 Support

🗺️ Roadmap

  • Add HTML output format
  • Implement historical data tracking
  • Add system health scoring
  • Create interactive TUI mode
  • Multi-vendor GPU support (NVIDIA/AMD/Intel) - COMPLETED
  • GPU per-process memory breakdown
  • Package for major distributions (AUR, deb, rpm) - AUR COMPLETED
  • Add plugin system for custom modules

Made with ❤️ by Ninso112

About

🔍 RustWhy - Unified Linux System Diagnostics Suite. Understand WHY your system behaves the way it does. 13 diagnostic modules in one powerful CLI: CPU, memory, disk, network, temperature, fan, GPU, battery, boot, sleep, USB & mount analysis. Written in Rust for maximum performance.

Topics

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages