hw 0.1.0

MII - Machine Internal Inspection
Documentation

πŸ“„ δΈ­ζ–‡ | πŸ“„ English

Test Status Book API API

A Powerful Cross-Platform Hardware Monitoring Tool

πŸ“ Project Introduction

Integrates multiple hardware monitoring backends and provides a unified command-line interface This is a hardware monitoring tool written in Rust that supports multiple monitoring backends and sensor types. It can:

  • Monitor system hardware status in real-time
  • Support multiple hardware monitoring backends
    • OpenHardwareMonitor (Windows)
    • AIDA64 (Windows)
    • sysinfo (Cross-platform)
  • Provide rich monitoring metrics
    • CPU (frequency, temperature, load, power)
    • GPU (NVIDIA/AMD graphics card status)
    • Memory usage
    • Hard drive status
    • Motherboard sensors
    • Fan speed
  • Unified command-line interface
    • Simple and intuitive command parameters
    • Flexible data queries
    • Support data export
    • Threshold alerting functionality

πŸ’‘ Main Features

  • Multi-backend Support: Integrates various hardware monitoring solutions for different scenarios
  • Cross-platform Compatibility: Provides basic cross-platform support through sysinfo
  • Rich Sensors: Supports various sensor types including temperature, frequency, load, etc.
  • Real-time Monitoring: Provides real-time hardware status monitoring and data collection
  • Unified Interface: Simplified command-line interface with unified data format
  • Extensibility: Modular design for easy extension of new monitoring backends
  • Performance Optimization: Low resource usage with efficient data collection and processing

πŸ“Έ Interface Preview and Command Examples

OpenHardwareMonitor Monitoring

OHM Monitoring Interface

CPU Clock Monitoring Example

  1. data command - Returns current value only
$ hw --api OS --task data --args CPU Clock
R<{"content":"2904","status":true,"opts":null}>R
  1. print command - Returns complete statistics
$ hw --api OS --task print --args CPU Clock
R<{"content":"{\"api\":\"OS\",\"hw_type\":\"CPU\",\"sensor_type\":\"Clock\",\"res\":\"PASS\",\"data\":\"2904\",\"min\":2904.0,\"max\":2904.0,\"avg\":2904.0,\"total\":104544.0,\"samples\":36,\"test_secs\":0,\"error_count\":0,\"load\":{\"min\":0.0,\"max\":0.0,\"avg\":99.0,\"total\":3576.0,\"status\":[]},\"status\":[[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0]]}","status":true,"opts":null}>R
  1. check command - Performs value range validation and load testing
$ hw --api OS --task check --args CPU Clock -- 10 2000 3000 100
R<{"content":"{\"api\":\"OS\",\"hw_type\":\"CPU\",\"sensor_type\":\"Clock\",\"res\":\"PASS\",\"data\":\"2904\",\"min\":2904.0,\"max\":2904.0,\"avg\":2904.0,\"total\":104544.0,\"samples\":36,\"test_secs\":0,\"error_count\":0,\"load\":{\"min\":0.0,\"max\":0.0,\"avg\":99.0,\"total\":3576.0,\"status\":[]},\"status\":[[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0],[\"\",2904.0]]}","status":true,"opts":null}>R

Command Differences Explanation:

  • data: Returns current sensor value only
  • print: Returns complete statistics without validation
  • check: Performs value range validation and load testing
    • 10: Number of tests
    • 2000: Target value
    • 3000: Error range (-1000~5000)
    • 100: CPU load percentage

AIDA64 Monitoring

AIDA64 Monitoring Interface

sysinfo Monitoring

System Monitoring Interface

Sensor Type Support Details

Hardware Type Support Details

Monitoring Backend Feature Comparison

πŸš€ Development Progress

Legend:

  • βœ“ Completed
  • ⚑ In Progress
  • πŸ”„ Beta/Testing
  • βœ— Not Started

Note:

  • OpenHardwareMonitor (OHM) and AIDA64 only support Windows platform
  • sysinfo supports cross-platform but with limited functionality
  • Specific sensor support may vary by hardware

Quick Start

Installation

# Install build tools
cargo install just
# More commands
just help
# Build project
just

Basic Usage

# Print all hardware information
hw --api OHM --task print

# Check specific hardware metrics
hw --api OHM --task check --args CPU Temperature

Command Line Parameters

hw --api <API> --task <TASK> --args <HW_TYPE> <SENSOR_TYPE> -- [OPTIONS]

Parameter Description

  • --api: Select monitoring backend
    • OHM: OpenHardwareMonitor
    • AIDA64: AIDA64
    • OS: sysinfo
  • --task: Task type
    • print: Print data
    • check: Check values
    • data: Return raw data
  • --args: Hardware and sensor type
  • --: Additional parameters (test count/target value/error range/CPU load)

Binary Call Usage Examples

OpenHardwareMonitor

# CPU temperature monitoring
hw --api OHM --task check --args CPU Temperature

# CPU frequency test (5 times, target 3000MHz, error Β±2000MHz, 100% load)
hw --api OHM --task check --args CPU Clock -- 5 3000 2000 100

# Fan speed test (5 times, target 3000RPM, error Β±2000RPM)
hw --api OHM --task check --args ALL Fan -- 5 3000 2000

AIDA64

# Memory usage monitoring
hw --api AIDA64 --task check --args RAM Load

# CPU core voltage monitoring
hw --api AIDA64 --task check --args CPU Voltage

sysinfo

# Overall system status
hw --api OS --task print

# CPU load monitoring
hw --api OS --task check --args CPU Load

Rust Call Usage Examples

πŸ“– Features

[dependencies]
# All features
hw = {version="0.1", default-features = false, feature=["cli", "ohm", "aida64", "os"]}
# For packaging
hw = {version="0.1", default-features = false, feature=["cli", "ohm", "aida64", "os","build"]}

πŸ”’ Using CLI for Internal Calls

#[cfg(feature = "cli")]
#[tokio::main]
async fn main() -> e_utils::AnyResult<()> {
  use e_utils::cmd::CmdResult;
  use hw::cli::api;
  use hw::cli::Opts;
  use serde_json::Value;
  let opts = Opts::new(None as Option<Vec<&str>>)?;
  let mut res: CmdResult<Value> = CmdResult {
    content: String::new(),
    status: false,
    opts: Value::Null,
  };
  match api(opts, &mut res.opts).await {
    Ok(v) => {
      res.content = v;
      res.status = true;
    }
    Err(e) => res.content = e.to_string(),
  }
  println!("\n{}", res.to_str()?);
  Ok(())
}

πŸ“– Rust调用OHMεšε†…ιƒ¨θ°ƒη”¨

πŸ“– Rust调用OSεšε†…ιƒ¨θ°ƒη”¨

πŸ“– Rust调用AIDA64εšε†…ιƒ¨θ°ƒη”¨


Dependencies Version

  • OpenHardwareMonitor: v0.9.6
  • AIDA64: v7.40.7100
  • sysinfo: v0.33

Notes About Third-party Applications

When using OHM or AIDA64 interfaces, the program first checks if the process exists; If not, it checks if OpenHardwareMonitor.exe or aida64.exe exists in the current directory

πŸ“Š Performance Benchmarks


🦊 Projects Using This Tool

AUTOTEST2.exe


πŸ”­ Why Choose This Tool?

In the field of hardware monitoring, we often face these challenges:

  • Large differences in monitoring interfaces across platforms
  • Complex sensor data acquisition on Windows
  • Rust support
  • Lack of unified data access methods
  • Cumbersome switching between multiple monitoring tools
  • Limited automated testing support

This tool aims to solve these problems by providing:

🎯 Unified Access Interface

  • Command Line Tool: Simple and intuitive CLI commands
  • Rust API: Native Rust programming interface
  • WMI Support: WMI query capability for Windows platform
  • Rust Support: Direct library calls in Rust
  • Unified Data Format: Standardized data output

πŸ’» Seamless Multi-platform Support

  • Windows: Complete sensor support (OHM/AIDA64)
  • Linux: Basic system information monitoring (sysinfo)
  • MacOS: Basic system information monitoring (sysinfo)

πŸ”Œ Rich Integration Capabilities

  • Automated Testing: Support for automated hardware testing scenarios
  • Data Collection: Flexible data collection and export
  • Monitoring Alerts: Configurable threshold monitoring
  • Extension Interface: Support for custom monitoring backends

πŸ› οΈ Ready to Use

  • Zero Configuration: Minimal configuration requirements
  • Quick Deployment: Single executable file
  • Backward Compatibility: Maintains API stability
  • Complete Documentation: Detailed usage instructions

πŸ“Š Typical Application Scenarios

  1. Hardware Testing

    • Product quality validation
    • Performance benchmarking
    • Stability testing
  2. System Monitoring

    • Server status monitoring
    • Workstation performance analysis
    • Temperature control system monitoring
  3. Development Debugging

    • Hardware driver development
    • Performance optimization analysis
    • Problem diagnosis
  4. Automation Integration

    • CI/CD pipeline integration
    • Automated test scripts
    • Monitoring system integration

πŸ’‘ Design Philosophy:

  • Simplicity first
  • Unified interface standards
  • Cross-platform compatibility
  • Extensible architecture

πŸ™‹ Reference Projects and Resources


License

LICENSE COPYRIGHT