Open Source · Go · Linux

rbstat

A single-binary Go clone of the classic Linux dstat resource monitor. It samples /proc every interval, diffs the counters, and prints colorized, dash-padded, fixed-width columns — matched column-for-column against dstat.

At a Glance

Language
Go 1.22+, stdlib only
Binary
Single static binary (~2 MB, no deps)
Platform
Linux (reads /proc)
Stat groups
10 (cpu, disk, net, page, sys, mem, swap, load, time, io)
Reference
Matched to pcp-dstat 7.1.5
Color
Magnitude-bucketed ANSI, auto-off when piped
Arches
amd64, arm64, 386, arm, ppc64le, s390x, riscv64
Packages
EL9 & EL10 RPMs + static binaries

Features

dstat-faithful output

Dash-padded group bars, blue | separators, the dchg/fchg number formatter (base-1024 bytes with B/k/M/G suffixes), and the magnitude-based color buckets are reproduced exactly — verified side by side against the real dstat.

Ten stat groups

CPU (usr/sys/idl/wai/stl), disk throughput, net throughput, paging (swap in/out), system (interrupts & context switches), memory, swap, load average, time, and disk I/O requests — selectable and clusterable.

Reads /proc, diffs counters

Cumulative counters from /proc/stat, /proc/diskstats, /proc/net/dev, /proc/vmstat and /proc/meminfo are diffed over the measured wall-clock interval. A per-tick cache keeps cpu+sys and disk+io views consistent.

Accurate memory

used follows the procps/free formula (total − free − buffers − cached − SReclaimable + Shmem), matching dstat to the kilobyte rather than over-counting reclaimable slab.

Since-boot first line

The first row shows the average since boot (classic dstat / vmstat behavior) — every later row is a true interval rate.

Clustered flags

dstat-style CLI: rbstat -cdn 1 5 selects cpu, disk and net, updating every second five times. Positional [delay [count]], plus --nocolor, --noheaders, --list.

Zero dependencies

A single statically-linked binary built with CGO_ENABLED=0. Drop it on any Linux box — no runtime, no libraries, no install required.

Packaged everywhere

Every release ships EL9 and EL10 RPMs (x86_64 + aarch64) and stripped static binaries for seven architectures, with a SHA256SUMS manifest.

Usage

# default view (-cdngy), updating every second
rbstat

# cpu + disk + net, every 2s, 10 times
rbstat -cdn 2 10

# everything, no color, headers once
rbstat -cdngymslrt --nocolor --noheaders
FlagGroupColumns
-ctotal usageusr sys idl wai stl
-ddsk/totalread writ
-nnet/totalrecv send
-gpagingin out
-ysystemint csw
-mmemory usageused free buf cach
-sswapused free
-lload avg1m 5m 15m
-ttimecurrent time
-rio/totalread writ (IOPS)

Install

Prebuilt artifacts are attached to every GitHub release.

# RPM — RHEL / CentOS / Rocky / Alma 9 & 10
sudo rpm -Uvh https://github.com/binRick/rbstat/releases/latest/download/rbstat-0.1.0-1.el10.x86_64.rpm

# static binary — pick your arch
curl -L -o rbstat https://github.com/binRick/rbstat/releases/latest/download/rbstat-0.1.0-linux-amd64
chmod +x rbstat && ./rbstat

# or build from source (Go 1.22+)
go install github.com/binRick/rbstat@latest

Architecture

Each stat group implements a small Collector interface. Rate groups share one counter-diffing helper; gauge groups return instantaneous values. Rendering, number formatting, and color are pure, /proc-free packages.

main.go        wire CLI -> engine
cli.go         clustered short flags, [delay [count]]
engine.go      sample loop, since-boot priming, tty detect, signals
internal/collect      Collector interface, RateBase, /proc parsing
internal/collectors   one file per stat group
internal/format       str.center dash padding + dchg/fchg formatter
internal/color        ANSI theme + value-coloring rule
internal/render       header, data rows, separators, header cadence