Reference · reference

sys module

1 min read · 2026-09-02 · config-weave 0.1.0

use sys reports facts about the operating system and hardware. Gatherers use it to publish the values that conditions in a playbook test. No function in this module fails. For the process environment and the current user, see the env module.

family

rust
sys::family() -> string

The operating system family: linux, windows or macos. Use it to guard a call into a Windows-only module.

os_name and os_version

rust
sys::os_name() -> string
sys::os_version() -> string

The name and version of the operating system. On Linux the name is the distribution name.

kernel_version

rust
sys::kernel_version() -> string

The kernel version string.

arch

rust
sys::arch() -> string

The CPU architecture, such as x86_64 or aarch64.

cpu_count

rust
sys::cpu_count() -> int

The number of logical CPUs.

total_memory and available_memory

rust
sys::total_memory() -> int
sys::available_memory() -> int

Physical memory in bytes: the total installed, and the amount available now.

rust
use sys
use value

fn gather(params: Value) -> Value {
    Value::Map(#{
        "family": Value::String(sys::family()),
        "arch": Value::String(sys::arch()),
        "cpus": Value::Int(sys::cpu_count())
    })
}