#information #metrics #process #proc #kernel #system-information #retrieve

procsys

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

3 releases (breaking)

0.5.0 Sep 15, 2024
0.4.0 Aug 18, 2024
0.3.0 Jul 28, 2024
0.2.0 Jul 13, 2024
0.1.0 Jun 30, 2024

#538 in Encoding

Download history 149/week @ 2024-06-28 7/week @ 2024-07-05 111/week @ 2024-07-12 2/week @ 2024-07-19 147/week @ 2024-07-26 12/week @ 2024-08-02 146/week @ 2024-08-16 7/week @ 2024-08-23 179/week @ 2024-09-13 16/week @ 2024-09-20 7/week @ 2024-09-27 1/week @ 2024-10-04

203 downloads per month

MIT license

290KB
6K SLoC

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.

Dependencies

~4–12MB
~138K SLoC