Module Munin_sys
System monitoring.
Provides stateless, poll-based system metrics sampling and background session monitoring. Each module samples instantaneous or cumulative values from the operating system. CPU, network, and disk I/O statistics are cumulative since boot and require two samples to compute usage percentages; memory statistics are instantaneous.
Platform support
Supported platforms: Linux and macOS. Platform-specific behavior is documented per module. Some metrics have limited availability on certain platforms (e.g., macOS CPU counters populate only user/nice/system/idle fields).
Background monitoring
start spawns a background thread that periodically samples CPU, memory, and process statistics and logs them as scalar metrics via Munin.Session.
Logged metrics (all with sys/ prefix):
System-wide:
sys/cpu_user— user CPU percentage (0–100)sys/cpu_system— system CPU percentage (0–100)sys/mem_used_pct— memory usage percentage (0–100)sys/mem_used_gb— memory used in GB
Per-process:
sys/proc_cpu_pct— process CPU percentagesys/proc_mem_mb— process resident set size in MB
Disk I/O:
sys/disk_read_mbs— disk read rate in MB/ssys/disk_write_mbs— disk write rate in MB/ssys/disk_util_pct— disk utilization percentage
Platform support
Supported platforms: Linux and macOS. Platform-specific behavior is documented per module. Some metrics have limited availability on certain platforms (e.g., macOS CPU counters populate only user/nice/system/idle fields).
Modules
module Cpu : sig ... endCPU statistics.
module Mem : sig ... endMemory statistics (instantaneous).
module Net : sig ... endNetwork I/O statistics.
module Disk_io : sig ... endDisk I/O statistics.
module Fs : sig ... endFilesystem statistics (instantaneous).
module Proc : sig ... endProcess statistics.
System information
loadavg () returns the 1, 5, and 15 minute load averages.
Background monitoring
start session ~interval () begins periodic system monitoring.
All sys/ metrics are defined with ~summary:`Last so the final sampled value appears in run summaries.
interval defaults to 2.0 seconds. The first sample is taken after one interval. The monitor thread is a daemon thread.
val stop : t -> unitstop t signals the monitoring thread to exit and blocks until it terminates. Safe to call multiple times.