Skip to main content

Module sysmon

Module sysmon 

Source
Expand description

Session-level system-performance sampler (SRD-118).

Enabled per session with sysmon=<categories>: sysmon=all, sysmon=any, or a comma list of category names. all and any differ in exactly one way: all ABORTS when a subsystem is unavailable, any enables what the host supports and NAMES what it skipped. Reads /proc (and statvfs) on a fixed interval (default 5 s, sysmon_interval=<seconds>) and publishes host-side measures as session-scoped gauges plus a live observer callback for display surfaces: measurement of the machine under the workload, not of the workload.

The categories, each in its own module:

  • cpu (cpu): mean utilization, the hottest core, and the quartiles of the per-core distribution.
  • io (disk): how busy the busiest device is, and each whole device’s read and write throughput.
  • ram (mem): memory committed, and memory touched (page cache included).
  • rambw (mem): memory bandwidth against a stated peak, from resctrl.
  • storage (disk): how full the fullest writable filesystem is.
  • net (net): each interface’s receive and transmit throughput.
  • pressure (pressure): the share of time tasks were stalled for want of CPU, memory or I/O.
  • proc (process): CPU, memory, threads and storage I/O of nmbrs itself and of each process sysmon_procs= names.

Counters are cumulative, so every rate here is a pairwise delta over the sample window; the published gauge is the latest window’s value and any windowing beyond that belongs to MetricsQL at query time.

The parsers read strings, so the arithmetic is tested on fixtures; only the sampler and the read_* functions touch the filesystem.

Re-exports§

pub use cpu::CpuReading;

Modules§

cpu
CPU utilization from /proc/stat: the mean, the hottest core and the per-core quartiles (SRD-118 §3.1).
disk
Disks: how busy the busiest device is and how much each device reads and writes, from /proc/diskstats; and how full the fullest filesystem is, from statvfs (SRD-118 §3.2, §3.5).
gauges
The sampler’s gauges (SRD-118 §4): which families each category publishes, and writing a sample to them.
mem
Memory utilization from /proc/meminfo, and memory bandwidth from resctrl (SRD-118 §3.3, §3.4).
net
Network throughput per interface, from /proc/net/dev (SRD-118 §3.6).
pressure
Pressure stall information from /proc/pressure (SRD-118 §3.7): the share of time tasks were stalled for want of CPU, memory or I/O.
process
Per-process measures from /proc/<pid> (SRD-118 §3.8): CPU in cores, resident memory, threads, and bytes read from and written to storage.

Structs§

Categories
Which categories a sysmon= setting enabled.
SysmonConfig
Sampler configuration, resolved by the runner from session params.
SysmonSample
One completed sample window. A field is Some, or a list is filled, exactly when its category was enabled and had a reading — a disabled category is absent, not zero.

Enums§

Selection
What a sysmon= value asked for: a fixed category set, or “whatever this host supports”.

Constants§

CATEGORY_NAMES
The category names, in the order they are listed to a user.
UNSUPPORTED_PLATFORM
What the platform check says when it fails.

Functions§

check_pressure_requirements
The pressure prerequisite: the kernel’s pressure stall files.
check_rambw_requirements
The rambw prerequisites, checked BEFORE the session starts so an unsupported host aborts with instructions instead of silently monitoring less than was asked for.
check_requirements
Everything a named category needs of this host, checked before the session starts. sysmon_procs= without the proc category is refused here too: it would otherwise name processes nothing watches.
parse_categories
Parse a fixed category list (all or comma names). See parse_selection for the any form.
parse_selection
Parse a sysmon= value: all, any, or a comma list of category names. Unknown names are errors that NAME the valid set — a typo silently monitoring nothing would be the failure mode this surface exists to avoid.
platform_supported
The sampler reads /proc, which only Linux has.
resolve_any
Resolve sysmon=any against THIS host: every category the host supports, plus one human-readable line per category that had to be skipped and why. The /proc-backed categories are always available on Linux; rambw and pressure carry real prerequisites.
spawn
Spawn the sampler. check_requirements must have passed first — the runner aborts the session on its Err rather than calling this. Runs until session shutdown; publishes each window to the session gauges and to observer.sysmon_update.