Documentation
¶
Overview ¶
Package hostmon samples host CPU/RAM/disk for the read plane (plan §4). The parsing is pure and unit-tested cross-platform; the actual /proc + statfs reads are Linux-specific (the deploy target), with a no-op stub elsewhere so the binary still builds on a dev machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("hostmon: host metrics not supported on this platform")
ErrUnsupported is returned by Sample on non-Linux platforms.
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process struct {
PID int
PPID int
Name string
State string
RSS uint64 // resident set size in bytes
}
Process is one host process, for the read-only "task manager" view. Only the fields needed to answer "what's using the memory" are collected — no cmdline (which can leak secrets passed as args) and no signalling capability.
func Processes ¶
Processes returns the top-N host processes by resident memory (descending). It is a READ-ONLY snapshot for the UI; it never signals or mutates anything. Kernel threads (and anything with no resident memory) are skipped so the list is the userspace memory users an operator cares about. Per-pid read errors are tolerated (a process can exit mid-scan) — they're skipped, never fatal.
type Sample ¶
type Sample struct {
CPUPercent float64
Load1 float64
MemTotal uint64
MemUsed uint64
DiskTotal uint64
DiskUsed uint64
}
Sample is one host metrics reading.