From b69513019bcbb1ade5144e09e4aceaa985b126d0 Mon Sep 17 00:00:00 2001 From: John Haverlack Date: Sun, 8 Feb 2026 15:38:01 -0900 Subject: [PATCH] System Columnn Display --- README.md | 9 +++- changelog.json | 7 +++ docs/CHANGELOG.md | 28 +++++++++- sdl-mgr/app/modules/sdl-mgr/index.js | 26 +--------- sdl-mgr/html/js/dash.js | 77 ++++++++++++++++------------ sdl-mgr/html/md/changelog.md | 28 +++++++++- sdl-wkr/app/modules/sdl-wkr/index.js | 9 +++- 7 files changed, 118 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index 63e6b2a..73bd9d7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,14 @@ Or to get the install command from the beacon message: nc -u -l -k 10101 | jq -r '.msg.sdl_wkr_install_cmd[]' ``` -> NOTE: CTRL-C to exit `nc`. You cannot run `nc` on port 10101 in parallel with the sdl-wkr. So run it once to get the install command. Tnen install sdl-wkr. +**NOTE**: If you use UFW or a local firewall, you must allow SDL Worker to listen on UDP port 10101. + +``` +sudo ufw allow in proto udp from to any port 10101 +``` + +> **NOTE**: CTRL-C to exit `nc`. You cannot run `nc` on port 10101 in parallel with the sdl-wkr. So run it once to get the install command. Tnen install sdl-wkr. + Run the **curl** or **wget** command provided by SDL Manager UDP beacon to install SDL Worker locally. diff --git a/changelog.json b/changelog.json index caf96f4..d939605 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,12 @@ { "releases": [ + { + "version": "0.3.9", + "date": "2026-02-08", + "maturity": "ALPHA", + "summary": "", + "notes": "" + }, { "version": "0.3.8", "date": "2026-02-01", diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e950d88..62516b1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,11 +5,35 @@ | **Author** | John Haverlack | | **Copyright** | 2026 John Haverlack | | **License** | MIT | -| **Version** | 0.3.8 | -| **Date** | 2026-02-01 | +| **Version** | 0.3.9 | +| **Date** | 2026-02-08 | + +## v0.3.9 - 2026-02-08 (ALPHA) + +- Start v0.3.9 ## v0.3.8 - 2026-02-01 (ALPHA) +- v0.3.8 +- Refactoing Worker Dashboard +- Refactoing Worker Dashboard +- Refactored Cluster Status +- Refactor of telemetry format + hw detection +- Switched Panel Icon to Bootstrap Icon +- Updating Worker Telemetry +- CP +- Fixing Wget/Curl Command Installer Port +- Fixing Wget/Curl Command Installer Port +- Fixing Wkr Start / Stop +- Update stop-sdl-wkr.sh +- WIP Install / Start / Stop +- WIP Install / Start /Stop +- Systemd Detectiion in Start/Stop/Status +- WIP: Start / Stop Scripts +- Non Systemd start stop scripts +- WIP: start stop scripts +- Updating Task List +- Adding Screeshot to README - Start v0.3.8 ## v0.3.7 - 2026-02-01 (ALPHA) diff --git a/sdl-mgr/app/modules/sdl-mgr/index.js b/sdl-mgr/app/modules/sdl-mgr/index.js index e152706..fbb31eb 100644 --- a/sdl-mgr/app/modules/sdl-mgr/index.js +++ b/sdl-mgr/app/modules/sdl-mgr/index.js @@ -557,31 +557,7 @@ function startTelemetryListener() { const now = new Date(); // ✅ Build/update worker state from telemetry - workersState[sdl_id] = { - sdl_id: sdl_id, - hostname: hostname, - role: telemetry.role, - last_seen: now.toISOString(), // ✅ ISO string - last_seen_utime: Math.floor(now.getTime() / 1000), // ✅ Unix timestamp (seconds) - - // System info - platform: telemetry.msg?.system?.platform, - arch: telemetry.msg?.system?.arch, - distro: telemetry.msg?.system?.distro, - hardware: telemetry.msg?.system?.hardware, - - // Uptime - uptime: telemetry.msg?.uptime, - - // Resources - resources: telemetry.msg?.resources, - - // Usage - usage: telemetry.msg?.usage, - - // Load - load: telemetry.msg?.load - }; + workersState[sdl_id] = telemetry } catch (err) { log(`${module}: failed to process telemetry: ${err}`); diff --git a/sdl-mgr/html/js/dash.js b/sdl-mgr/html/js/dash.js index 7689997..1a8edb5 100644 --- a/sdl-mgr/html/js/dash.js +++ b/sdl-mgr/html/js/dash.js @@ -513,57 +513,65 @@ function renderWorkersTable(msg) { const staleThresholdSec = 60; for (const [sdl_id, worker] of Object.entries(workers)) { - const ageSec = nowSec - worker.last_seen_utime; + const ageSec = nowSec - worker.ts_utime; // ✅ Use ts_utime from telemetry const isActive = ageSec <= staleThresholdSec; // Status badge const statusBadge = isActive ? 'Active' - : 'Inactive'; // ✅ Red instead of grey + : 'Inactive'; - // Hardware info - const hwType = worker.hardware?.type || 'unknown'; - const hwIcon = hwType === 'hw' ? '🖥️' : hwType === 'vm' ? '💠' : '❓'; - const hwManuf = worker.hardware?.manufacturer || 'Unknown'; - const hwModel = worker.hardware?.model || 'Unknown'; + // ✅ Hardware info from nested msg.system.hardware + const hwType = worker.msg?.system?.hardware?.type || 'unknown'; + // const hwIcon = hwType === 'hw' ? '🖥️' : hwType === 'vm' ? '💠' : '❓'; + const hwIcon = hwType === 'hw' ? '' : + hwType === 'vm' ? '' : + ''; + const hwManuf = worker.msg?.system?.hardware?.manufacturer || 'Unknown'; + const hwModel = worker.msg?.system?.hardware?.model || 'Unknown'; + const hwCPU = worker.msg?.system?.hardware?.cpu || 'Unknown'; - // ✅ Full hardware display with model const hardwareDisplay = hwType === 'vm' ? `${hwIcon} ${hwModel}` : `${hwIcon} ${hwManuf} ${hwModel}`; - // ✅ OS info - const osDistro = worker.distro || 'Unknown'; - const osArch = worker.arch || 'unknown'; - const osPlatform = worker.platform || 'unknown'; + // ✅ OS info from nested msg.system + const osDistro = worker.msg?.system?.distro.replace(/\(\S+\)/, '') || 'Unknown'; + const osArch = worker.msg?.system?.arch || 'unknown'; + const osPlatform = worker.msg?.system?.platform || 'unknown'; + const platformIcon = osPlatform === 'linux' ? '' : + osPlatform === 'win32' ? '' : + osPlatform === 'darwin' ? '' : + ''; - // CPU - const cpuAvail = worker.resources?.cpus?.available || 0; - const cpuTotal = worker.resources?.cpus?.allocated || 0; - const cpuUsed = worker.usage?.cpu?.total || 0; + const osDisplay = `${platformIcon} ${osDistro} (${osArch})`; - // Memory - const memAvail = worker.resources?.memory?.available || 0; - const memTotal = worker.resources?.memory?.allocated || 0; - const memUsed = worker.usage?.memory?.used || 0; + // ✅ CPU from nested msg.resources and msg.usage + const cpuAvail = worker.msg?.resources?.cpus?.available || 0; + const cpuTotal = worker.msg?.resources?.cpus?.allocated || 0; + const cpuUsed = worker.msg?.usage?.cpu?.total || 0; + + // ✅ Memory from nested msg + const memAvail = worker.msg?.resources?.memory?.available || 0; + const memTotal = worker.msg?.resources?.memory?.allocated || 0; const memAvailGB = Math.round(memAvail / (1024 * 1024 * 1024)); const memTotalGB = Math.round(memTotal / (1024 * 1024 * 1024)); - const memPercent = worker.usage?.memory?.percent_used || 0; + const memPercent = worker.msg?.usage?.memory?.percent_used || 0; - // GPU - const gpuAvail = worker.resources?.gpus?.available || 0; - const gpuTotal = worker.resources?.gpus?.allocated || 0; - const gpuData = worker.usage?.gpu; + // ✅ GPU from nested msg + const gpuAvail = worker.msg?.resources?.gpus?.available || 0; + const gpuTotal = worker.msg?.resources?.gpus?.allocated || 0; + const gpuData = worker.msg?.usage?.gpu; const gpuUsed = gpuData?.total_utilization || 0; const gpuMemMB = gpuData?.total_memory_total_mb || 0; const gpuMemGB = Math.round(gpuMemMB / 1024); - // Uptime - const procUptime = worker.uptime?.proc_dhms || 'N/A'; - const sysUptime = worker.uptime?.sys_dhms || 'N/A'; + // ✅ Uptime from nested msg.uptime + const procUptime = worker.msg?.uptime?.proc_dhms || 'N/A'; + const sysUptime = worker.msg?.uptime?.sys_dhms || 'N/A'; - // ✅ Last seen age + // Last seen age const days = Math.floor(ageSec / 86400); const hours = Math.floor((ageSec % 86400) / 3600); const minutes = Math.floor((ageSec % 3600) / 60); @@ -577,15 +585,16 @@ function renderWorkersTable(msg) { html += ''; - // ✅ Hostname column with hardware underneath + // System column html += ` - ${worker.hostname}
- ${worker.sdl_id}
+ ${worker.host}
+ ${worker.sdl_id.substring(0, 8)}...
${hardwareDisplay}
- ${osDistro} ${osArch} ${osPlatform} + ${memTotalGB} GB | ${cpuTotal}x ${hwCPU}}
+ ${osDisplay} `; - // ✅ Status column with uptime and last seen + // Status column html += ` ${statusBadge}
SDL: ${procUptime}
diff --git a/sdl-mgr/html/md/changelog.md b/sdl-mgr/html/md/changelog.md index e950d88..62516b1 100644 --- a/sdl-mgr/html/md/changelog.md +++ b/sdl-mgr/html/md/changelog.md @@ -5,11 +5,35 @@ | **Author** | John Haverlack | | **Copyright** | 2026 John Haverlack | | **License** | MIT | -| **Version** | 0.3.8 | -| **Date** | 2026-02-01 | +| **Version** | 0.3.9 | +| **Date** | 2026-02-08 | + +## v0.3.9 - 2026-02-08 (ALPHA) + +- Start v0.3.9 ## v0.3.8 - 2026-02-01 (ALPHA) +- v0.3.8 +- Refactoing Worker Dashboard +- Refactoing Worker Dashboard +- Refactored Cluster Status +- Refactor of telemetry format + hw detection +- Switched Panel Icon to Bootstrap Icon +- Updating Worker Telemetry +- CP +- Fixing Wget/Curl Command Installer Port +- Fixing Wget/Curl Command Installer Port +- Fixing Wkr Start / Stop +- Update stop-sdl-wkr.sh +- WIP Install / Start / Stop +- WIP Install / Start /Stop +- Systemd Detectiion in Start/Stop/Status +- WIP: Start / Stop Scripts +- Non Systemd start stop scripts +- WIP: start stop scripts +- Updating Task List +- Adding Screeshot to README - Start v0.3.8 ## v0.3.7 - 2026-02-01 (ALPHA) diff --git a/sdl-wkr/app/modules/sdl-wkr/index.js b/sdl-wkr/app/modules/sdl-wkr/index.js index 79d684c..13c06c5 100644 --- a/sdl-wkr/app/modules/sdl-wkr/index.js +++ b/sdl-wkr/app/modules/sdl-wkr/index.js @@ -391,9 +391,13 @@ function publishTelemetry(topic) { ? Math.round(perCpuUsage.reduce((sum, usage) => sum + usage, 0) / perCpuUsage.length) : 0; + const now = new Date(); + const telemetry = { - ts: new Date().toISOString(), + ts: now.toISOString(), + ts_utime: Math.floor(now.getTime() / 1000), sdl_id: config.identity.sdl_id, + sdl_ver: config.sdl.version, role: 'sdl-wkr', host: config.identity.hostname, type: 'worker-telemetry', @@ -511,7 +515,8 @@ function getSystemHardware() { const hardware = { type: 'unknown', manufacturer: 'Unknown', - model: 'Unknown' + model: 'Unknown', + cpu: config.host.cpu.model }; // Only run Linux-specific detection on Linux