diff --git a/sdl-mgr/html/js/dash.js b/sdl-mgr/html/js/dash.js
index 1a8edb5..eb21fcd 100644
--- a/sdl-mgr/html/js/dash.js
+++ b/sdl-mgr/html/js/dash.js
@@ -54,14 +54,14 @@ if (Array.isArray(config.host.gpu) && config.host.gpu.length > 0) {
// Hostinfo: hostname, cpu, cores, ram, os
const hostinfo = {
- "hostname": '' + config.host.hostname + '',
"sdl_id": '' + config.identity.sdl_id + '',
- "cpu cores": '' + config.host.cpu.cores_logical + ' ' + config.host.cpu.model + '',
- // "cores": config.host.cpu.cores_logical,
- "ram": '' + config.host.memory.total_gb + ' GB ',
- "gpu": gpuSummary,
- "net": "",
- "os": config.host.os.pretty_name
+ "hostname": '' + config.host.hostname + '',
+ // "cpu cores": '' + config.host.cpu.cores_logical + ' ' + config.host.cpu.model + '',
+ // // "cores": config.host.cpu.cores_logical,
+ // "ram": '' + config.host.memory.total_gb + ' GB ',
+ // "gpu": gpuSummary,
+ // "net": "",
+ // "os": config.host.os.pretty_name
}
@@ -70,7 +70,7 @@ for (let intf in config.host.network) {
if (intf != 'lo') {
for (let addr in config.host.network[intf]) {
if (config.host.network[intf][addr].family == 'IPv4') {
- hostinfo["net"] += '' + config.host.network[intf][addr].cidr + '
';
+ hostinfo["net"] += '' + config.host.network[intf][addr].cidr + ' ';
}
}
}
@@ -79,12 +79,7 @@ for (let intf in config.host.network) {
let host_html = '
Manager
\n';
host_html += '\n';
-// host_html += '\n';
-// host_html += '\n';
-// host_html += '| Key | \n';
-// host_html += 'Value | \n';
-// host_html += '
\n';
-// host_html += '\n';
+
host_html += '\n';
for (let key in hostinfo) {
@@ -97,7 +92,7 @@ for (let key in hostinfo) {
host_html += '\n';
host_html += '
\n';
-document.getElementById('dash-sdl-mgr-info').innerHTML = host_html;
+// document.getElementById('dash-sdl-mgr-info').innerHTML = host_html;
initMqtt();
@@ -245,9 +240,11 @@ async function initMqtt() {
lastSdlStatus = msg;
lastSdlTimestamp = Date.parse(msg.ts);
renderModulesTable(msg);
+ // renderClusterSummary(msg);
} else if (msg.type === 'cluster-workers') {
lastWorkers = msg;
renderWorkersTable(msg);
+ renderClusterSummary(msg);
}
} catch (e) {
@@ -302,109 +299,78 @@ function renderModulesTable(msg) {
//
// `;
- sdl_html += `
-
- | Name |
- ${msg.msg.cluster.name} |
-
- `;
-
- sdl_html += `
-
- | Description |
- ${msg.msg.cluster.desc} |
-
- `;
-
- // Workers stats
- const workers = msg.msg.workers || { allocated: 0, available: 0, used: 0 };
- sdl_html += `
-
- | SDL Workers |
-
- ${workers.available}
- |
-
- `;
// sdl_html += `
//
- // | SDL Workers (active/total) |
+ // Name |
+ // ${msg.msg.cluster.name} |
+ //
+ // `;
+
+ // sdl_html += `
+ //
+ // | Description |
+ // ${msg.msg.cluster.desc} |
+ //
+ // `;
+
+ // Workers stats
+ // const workers = msg.msg.workers || { allocated: 0, available: 0, used: 0 };
+ // sdl_html += `
+ //
+ // | SDL Workers |
//
- // ${workers.available} / ${workers.allocated}
+ // ${workers.available}
// |
//
// `;
+
// CPU resources
- const cpus = msg.msg.resources?.cpus || { allocated: 0, available: 0, used: 0 };
- sdl_html += `
-
- | CPU Cores |
-
- ${cpus.available}
- |
-
- `;
+ // const cpus = msg.msg.resources?.cpus || { allocated: 0, available: 0, used: 0 };
// sdl_html += `
//
// | CPU Cores |
//
- // ${cpus.available} / ${cpus.allocated}
- // ${cpus.used > 0 ? `(${cpus.used} in use)` : ''}
+ // ${cpus.available}
// |
//
// `;
- // Memory resources
- const memory = msg.msg.resources?.memory || { allocated: 0, available: 0, used: 0 };
- const memAllocGB = Math.round(memory.allocated / (1024 * 1024 * 1024));
- const memAvailGB = Math.round(memory.available / (1024 * 1024 * 1024));
- const memUsedGB = memory.used > 0 ? Math.round(memory.used / 1024) : 0;
- sdl_html += `
-
- | RAM |
-
- ${memAvailGB} GB
- |
-
- `;
+ // Memory resources
+ // const memory = msg.msg.resources?.memory || { allocated: 0, available: 0, used: 0 };
+ // const memAllocGB = Math.round(memory.allocated / (1024 * 1024 * 1024));
+ // const memAvailGB = Math.round(memory.available / (1024 * 1024 * 1024));
+ // const memUsedGB = memory.used > 0 ? Math.round(memory.used / 1024) : 0;
+
// sdl_html += `
- //
- // | RAM (GB) |
- //
- // ${memAvailGB} / ${memAllocGB} GB
- // ${memUsedGB > 0 ? `(${memUsedGB} GB in use)` : ''}
- // |
- //
- // `;
+ //
+ // | RAM |
+ //
+ // ${memAvailGB} GB
+ // |
+ //
+ // `;
+
// GPU resources
- const gpus = msg.msg.resources?.gpus || { allocated: 0, available: 0, used: 0 };
- sdl_html += `
-
- | GPU (VRAM) |
-
- ${gpus.available}
- |
-
- `;
+ // const gpus = msg.msg.resources?.gpus || { allocated: 0, available: 0, used: 0 };
// sdl_html += `
//
- // | GPU |
+ // GPU (VRAM) |
//
- // ${gpus.available} / ${gpus.allocated}
- // ${gpus.used > 0 ? `(${gpus.used} in use)` : ''}
+ // ${gpus.available}
// |
//
// `;
-
+
+
sdl_html += `
`;
- document.getElementById('dash-sdl-info').innerHTML = sdl_html;
+ sessionStorage.setItem('dash-sdl-uptime', msg.msg.sdl.uptime);
const modules = msg.msg.modules;
@@ -431,7 +397,7 @@ function renderModulesTable(msg) {
`;
- document.getElementById('dash-modules-list').innerHTML = html;
+ // document.getElementById('dash-modules-list').innerHTML = html;
}
@@ -450,23 +416,33 @@ function startStatusAgeMonitor() {
const ageMs = Date.now() - lastSdlTimestamp;
- const ageEl = document.getElementById('dash-modules-age');
+ // const ageEl = document.getElementById('dash-modules-age');
+
+ // if (ageMs > maxAgeMs) {
+ // ageEl.innerHTML =
+ // `
+ //
+ // SDL status stale (${Math.round(ageMs / 1000)}s)
+ // `;
+
+ // markAllModulesDown();
+ // } else {
+ // ageEl.innerHTML =
+ // `
+ //
+ // SDL online (${Math.round(ageMs / 1000)}s ago)
+ // `;
+ // }
+
+ // Save dash-sdl-status to Session Storage
if (ageMs > maxAgeMs) {
- ageEl.innerHTML =
- `
-
- SDL status stale (${Math.round(ageMs / 1000)}s)
- `;
-
- markAllModulesDown();
+ sessionStorage.setItem('dash-sdl-status', ' ' + Math.round(ageMs / 1000) + 's ago' + '');
} else {
- ageEl.innerHTML =
- `
-
- SDL online (${Math.round(ageMs / 1000)}s ago)
- `;
+ sessionStorage.setItem('dash-sdl-status', ' ' + Math.round(ageMs / 1000) + 's ago');
}
+
+ // sessionStorage.setItem('dash-sdl-status', Math.round(ageMs / 1000) + 's ago');
}, 1000);
}
@@ -628,4 +604,149 @@ function renderWorkersTable(msg) {
html += '';
document.getElementById('dash-sdl-wkrs').innerHTML = html;
+}
+
+
+function renderClusterSummary(msg) {
+ const workers = msg.msg?.workers || {};
+ const workerCount = Object.keys(workers).length;
+
+ // Aggregate resources from all workers
+ let totalCpus = 0;
+ let totalMemory = 0;
+ let totalGpus = 0;
+ let activeCpus = 0;
+ let activeMemory = 0;
+ let activeGpus = 0;
+ let activeWorkers = 0;
+
+ const nowSec = Math.floor(Date.now() / 1000);
+ const staleThresholdSec = 60;
+
+ for (const worker of Object.values(workers)) {
+ const ageSec = nowSec - worker.ts_utime;
+ const isActive = ageSec <= staleThresholdSec;
+
+ // Totals (all workers)
+ totalCpus += worker.msg?.resources?.cpus?.allocated || 0;
+ totalMemory += worker.msg?.resources?.memory?.allocated || 0;
+ totalGpus += worker.msg?.resources?.gpus?.allocated || 0;
+
+ // Active workers only
+ if (isActive) {
+ activeWorkers++;
+ activeCpus += worker.msg?.resources?.cpus?.available || 0;
+ activeMemory += worker.msg?.resources?.memory?.allocated || 0;
+ activeGpus += worker.msg?.resources?.gpus?.available || 0;
+ }
+ }
+
+ // Convert memory to GB
+ const totalMemoryGB = Math.round(totalMemory / (1024 * 1024 * 1024));
+ const activeMemoryGB = Math.round(activeMemory / (1024 * 1024 * 1024));
+
+ // Get cluster info from last status message
+ const clusterName = lastSdlStatus?.msg?.cluster?.name || 'Unknown';
+ const clusterDesc = lastSdlStatus?.msg?.cluster?.desc || '';
+
+ let html = `
+
+
Cluster: ${clusterName}
+ ${clusterDesc}
+
+ `;
+
+ html += '';
+
+ // SDL card
+ html += `
+
+
+
+
+ SDL
+
+ Version: v${config?.sdl?.version}
+ Uptime:
+ Status:
+
+
+
+ `;
+
+ // Workers card
+ html += `
+
+
+
+
+ Workers
+
+ ${activeWorkers}
+ of ${workerCount} total
+
+
+
+ `;
+
+ // CPU card
+ html += `
+
+
+
+
+ CPU Cores
+
+ ${activeCpus}
+ of ${totalCpus} total
+
+
+
+ `;
+
+ // Memory card
+ html += `
+
+
+
+
+ RAM
+
+ ${activeMemoryGB} GB
+ of ${totalMemoryGB} GB total
+
+
+
+ `;
+
+ // GPU card
+ html += `
+
+
+
+
+ GPUs
+
+ ${activeGpus}
+ of ${totalGpus} total
+
+
+
+ `;
+
+ html += '
'; // end row
+
+ document.getElementById('dash-sdl-clstr').innerHTML = html;
+
+ // Read dash-sdl-uptime from Session Storage
+ const dashSdlUptime = sessionStorage.getItem('dash-sdl-uptime');
+ if (dashSdlUptime) {
+ document.getElementById('dash-sdl-uptime').innerHTML = dashSdlUptime;
+ }
+
+ // Read dash-sdl-status from Session Storage
+ const dashSdlStatus = sessionStorage.getItem('dash-sdl-status');
+ if (dashSdlStatus) {
+ document.getElementById('dash-sdl-status').innerHTML = dashSdlStatus;
+ }
}
\ No newline at end of file
diff --git a/sdl-mgr/html/md/dash.md b/sdl-mgr/html/md/dash.md
index 2a61aed..e20014b 100644
--- a/sdl-mgr/html/md/dash.md
+++ b/sdl-mgr/html/md/dash.md
@@ -1,11 +1,6 @@