procsys

Crates.ioprocsys
lib.rsprocsys
version0.5.0
sourcesrc
created_at2024-06-30 08:40:37.584691
updated_at2024-09-15 07:37:59.895997
descriptionRust library to retrieve system, kernel, and process metrics from the pseudo-filesystems /proc and /sys
homepage
repository
max_upload_size
id1287851
size423,242
Navid Yaghoobi (navidys)

documentation

README

procsys

Rust library to retrieve system, kernel, and process metrics from the pseudo-filesystems /proc and /sys.

See the docs for more information about supported features, or view the features.md file of the project repository.

Examples

There are several examples in the documents and also in the examples directory of project repository.

use procsys::sysfs::class_watchdog;

let watchdog_devices = class_watchdog::collect().expect("watchdog information");

for wdev in &watchdog_devices {
    println!("name: {}", wdev.name);
    println!("boot status: {}", wdev.boot_status.unwrap_or_default());
    println!("timeout: {}", wdev.timeout.unwrap_or_default());
    println!("min_timeout: {}", wdev.min_timeout.unwrap_or_default());
    println!("max_timeout: {}", wdev.max_timeout.unwrap_or_default());
}

// print all watchdog devices information in json output
match serde_json::to_string_pretty(&watchdog_devices) {
    Ok(output) => println!("{}", output),
    Err(err) => {
        log::error!("{}", err);
        std::process::exit(1);
    }
}

License

Licensed under the MIT License.

Commit count: 0

cargo fmt