code wiki / _hdl_build / nx_resmon.nx
nx_resmon.nx
buildroot/runtime/_hdl_build/nx_resmon.nx
about
nx_resmon.nx -- the RESOURCE axis the health plane never had (debt seq897 / seq1005).
WHY THIS EXISTS: on 2026-07-25 nx_health returned {overall:OK, degraded:0, down:0} while the box was
at 93.4% swap exhaustion with nr_vmscan_immediate_reclaim 1.33e9 -- sustained thrash. The health plane
probes GATEWAYS ONLY, so the single most destabilising condition on the platform was invisible to
every instrument we owned.
LAW: an instrument that reports OK during the worst outage class it could ever see is not an instrument.
TWO AXES:
A. PRESSURE -- swap consumed / memory available. A LAGGING indicator: by the time it is red the
box is already thrashing.
B. LEAK CENSUS -- processes whose VmSize == VmPeak above a COMMITTED-memory floor. A LEADING
indicator: it fires while swap is still healthy. This is the fingerprint that
identified the leaking organs in the first place.
This organ owns the /proc walk and the printing ONLY. Both policy predicates live in nx_resmon_lib.nx
so the gate exercises the SAME code this runs (rule 9 single responsibility, rule 15 DRY).
Thresholds are data-driven from knowledge/status/resmon.conf (rule 11). Read-only.
Exit code IS the verdict so a caller can gate on it: 0=GREEN 1=AMBER 2=RED.
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_resmon_lib.nxnx_proc_ctl.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 24 | const RM_MAGIC_262144: i64 = 262144 |
| 26 | const RM_DIRBUF: i64 = 65536 |
| 27 | const RM_STATBUF: i64 = 4096 |
functions
| 29 | func main() -> i64 |