peach-workspace/peach-stats
2022-01-27 10:55:04 +02:00
..
src add go-sbot enabled / disabled check 2022-01-27 10:55:04 +02:00
.gitignore First workspace commit 2021-08-06 13:58:40 -04:00
.travis.yml First workspace commit 2021-08-06 13:58:40 -04:00
Cargo.toml add sbot docs and bump version 2022-01-25 11:39:28 +02:00
README.md add sbot docs and bump version 2022-01-25 11:39:28 +02:00

peach-stats

Generic badge

System statistics library for PeachCloud. Provides a wrapper around the probes and systemstat crates.

Currently offers the following system statistics and associated data structures:

  • 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

As well as the following go-sbot process statistics:

  • Sbot: state, memory, uptime, downtime

Example Usage

use peach_stats::{sbot, stats, StatsError};

fn main() -> Result<(), StatsError> {
    let cpu = stats::cpu_stats()?;
    let cpu_percentages = stats::cpu_stats_percent()?;
    let disks = stats::disk_usage()?;
    let load = stats::load_average()?;
    let mem = stats::mem_stats()?;
    let uptime = stats::uptime()?;
    let sbot_process = sbot::sbot_stats()?;

    // do things with the retrieved values...

    Ok(())
}

Feature Flags

Feature flags are used to offer Serialize and Deserialize implementations for all struct data types provided by this library. These traits are not provided by default. A choice of miniserde and serde is provided.

Define the desired feature in the Cargo.toml manifest of your project:

peach-stats = { version = "0.1.0", features = ["miniserde_support"] }

License

LGPL-3.0.