[object Object]

← back to build-pages

api/health: include loadavg {1m,5m,15m} for host-overload monitoring + 1 smoke

bae5063aea106462cf459fba8f35f12c6fb233bd · 2026-05-13 18:06:00 -0700 · SteveStudio2

Files touched

Diff

commit bae5063aea106462cf459fba8f35f12c6fb233bd
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 18:06:00 2026 -0700

    api/health: include loadavg {1m,5m,15m} for host-overload monitoring + 1 smoke
---
 server.js     | 6 +++++-
 test/smoke.js | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 5feeed3..9833c39 100644
--- a/server.js
+++ b/server.js
@@ -268,13 +268,17 @@ app.get('/healthz', (_req, res) => {
 });
 
 // /api/health — liveness + project count snapshot. Mirrors the asim/sod shape
-// so fleet-status.sh can render every site through one digest path.
+// so fleet-status.sh can render every site through one digest path. Includes
+// system loadavg (1m/5m/15m) so external monitors can catch host-overload
+// scenarios (we hit load=71 earlier in this session before noticing manually).
 app.get('/api/health', (_req, res) => {
   res.setHeader('Cache-Control', 'no-store');
+  const [l1, l5, l15] = require('os').loadavg();
   res.json({
     ok:        true,
     counts:    { projects: Object.keys(PROJECTS).length },
     uptime_s:  Math.floor(process.uptime()),
+    loadavg:   { '1m': +l1.toFixed(2), '5m': +l5.toFixed(2), '15m': +l15.toFixed(2) },
     ts:        Date.now(),
     as_of:     new Date().toISOString(),
   });
diff --git a/test/smoke.js b/test/smoke.js
index 66890b7..4e78f1c 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -56,6 +56,7 @@ function check(name, cond, hint = '') {
   check('api/health: ok',          /"ok":true/.test(r.body));
   check('api/health: uptime_s',    /"uptime_s":\d+/.test(r.body));
   check('api/health: projects',    /"projects":\d+/.test(r.body));
+  check('api/health: loadavg',     /"loadavg":/.test(r.body));
 
   // 3. /api/version
   r = await fetch('/api/version');

← a633cb5 ui: commit-detail prev/next history nav — walk forward/backw  ·  back to build-pages  ·  home: color-coded host load badge (green <8, yellow <20, red 552db5e →