Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/navidys/procsys

Rust library to retrieve system, kernel, and process metrics from the pseudo-filesystems /proc and /sys.
https://github.com/navidys/procsys

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# procsys [![][img_crates]][crates] [![][img_doc]][doc] [![][img_codecov]][codecov]

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](https://github.com/navidys/procsys/blob/main/FEATURES.md) file of the project repository.

## Examples

There are several examples in the documents and also in the [examples](https://github.com/navidys/procsys/tree/main/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](https://github.com/navidys/procsys/blob/main/LICENSE).

[img_crates]: https://img.shields.io/crates/v/procsys.svg
[img_doc]: https://img.shields.io/badge/rust-documentation-blue.svg
[img_codecov]: https://codecov.io/gh/navidys/procsys/branch/main/graph/badge.svg

[crates]: https://crates.io/crates/procsys
[doc]: https://docs.rs/procsys/
[codecov]: https://codecov.io/gh/navidys/procsys