Skip to content

๐Ÿ” 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.

License

Notifications You must be signed in to change notification settings

Ninso112/rustwhy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿ” RustWhy

CI License: GPL-3.0 Rust 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

Module Command Purpose
๐Ÿš€ Boot Analysis rustwhy boot Analyze boot performance and identify slow services
๐Ÿ’ป CPU Diagnostics rustwhy cpu Explain high CPU usage and top consumers
๐Ÿง  Memory Analysis rustwhy mem Understand memory consumption and identify leaks
๐Ÿ’พ Disk Analysis rustwhy disk Find what's consuming disk space
๐Ÿ“Š I/O Diagnostics rustwhy io Identify processes causing high disk I/O
๐ŸŒ Network Diagnostics rustwhy net Troubleshoot connectivity and performance issues
๐ŸŒก๏ธ Temperature Analysis rustwhy temp Monitor system temperatures and thermal throttling
๐Ÿ”Š Fan Diagnostics rustwhy fan Understand fan behavior and correlate with temps
๐ŸŽฎ GPU Analysis rustwhy gpu Comprehensive GPU diagnostics (NVIDIA/AMD/Intel)
๐Ÿ”‹ Battery Analysis rustwhy batt Diagnose battery drain and power consumption
๐Ÿ˜ด Sleep Diagnostics rustwhy sleep Identify sleep/suspend inhibitors
๐Ÿ”Œ USB Diagnostics rustwhy usb Troubleshoot USB device issues
๐Ÿ“ Mount Diagnostics rustwhy mount Debug 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 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

๐Ÿ“– 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)
  • 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

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published