2021-08-06 17:58:40 +00:00
# peach-stats
2021-12-09 07:44:27 +00:00
![Generic badge ](https://img.shields.io/badge/version-0.1.0-<COLOR>.svg )
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
System statistics library for PeachCloud. Provides a wrapper around the [probes ](https://crates.io/crates/probes ) and [systemstat ](https://crates.io/crates/systemstat ) crates.
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
Currently offers the following statistics and associated data structures:
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
- CPU: `user` , `system` , `nice` , `idle` (as values or percentages)
- Disk usage: `filesystem` , `one_k_blocks` , `one_k_blocks_used` ,
`one_k_blocks_free` , `used_percentage` , `mountpoint`
- Load average: `one` , `five` , `fifteen`
- Memory: `total` , `free` , `used`
- Uptime: `seconds`
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
## Example Usage
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
```rust
use peach_stats::StatsError;
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
fn main() -> Result< (), StatsError> {
let cpu = peach_stats::cpu_stats()?;
let cpu_percentages = peach_stats::cpu_stats_percent()?;
let disks = peach_stats::disk_usage()?;
let load = peach_stats::load_average()?;
let mem = peach_stats::mem_stats()?;
let uptime = peach_stats::uptime()?;
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
// do things with the retrieved values...
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
Ok(())
}
```
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
## License
2021-08-06 17:58:40 +00:00
2021-12-09 07:44:27 +00:00
LGPL-3.0.