diff --git a/api/endpoints/do_server.php b/api/endpoints/do_server.php index 7c7ef06..349c2ee 100644 --- a/api/endpoints/do_server.php +++ b/api/endpoints/do_server.php @@ -59,6 +59,22 @@ foreach ($rows as $r) { $uptimeDays = intdiv($uptime, 86400); $uptimeHrs = intdiv($uptime % 86400, 3600); + +// DO server agent metrics (jarvis-do agent reporting via Tailscale) +$doAgent = JarvisDB::query( + "SELECT metric_data FROM agent_metrics WHERE agent_id='jarvis-do_orbis' AND metric_type='system' ORDER BY recorded_at DESC LIMIT 1" +); +$doMet = []; +if (!empty($doAgent[0]['metric_data'])) { + $dm = json_decode($doAgent[0]['metric_data'], true) ?? []; + $doMet = [ + "cpu" => $dm['cpu_percent'] ?? 0, + "mem" => $dm['memory']['percent'] ?? 0, + "disk" => (int)($dm['disk'][0]['percent'] ?? 0), + "uptime" => $dm['uptime']['human'] ?? "--", + "online" => true, + ]; +} echo json_encode([ "ip" => "10.48.200.211", // JARVIS VM (PVE1) "reachable" => true, @@ -73,5 +89,6 @@ echo json_encode([ "uptime" => "{$uptimeDays}d {$uptimeHrs}h", "services" => $svcMap, "sites" => $sites, + "do_server" => $doMet, "timestamp" => date("c"), ]); diff --git a/public_html/assets/js/jarvis-app.js b/public_html/assets/js/jarvis-app.js index c50deb0..e887c2a 100644 --- a/public_html/assets/js/jarvis-app.js +++ b/public_html/assets/js/jarvis-app.js @@ -550,6 +550,21 @@ function renderDO(d) { `; }).join(''); } + + // WEB HOST (DO server agent metrics) + const ds = d.do_server || {}; + const doStatus = document.getElementById('do-host-status'); + const doCpu = document.getElementById('do-cpu'); + const doMem = document.getElementById('do-mem'); + const doDisk = document.getElementById('do-disk'); + if (ds.online) { + if (doStatus) { doStatus.textContent = '●'; doStatus.style.color = 'var(--green)'; } + if (doCpu) doCpu.textContent = (ds.cpu || 0) + '%'; + if (doMem) doMem.textContent = (ds.mem || 0) + '%'; + if (doDisk) doDisk.textContent = (ds.disk || 0) + '%'; + } else { + if (doStatus) { doStatus.textContent = '○'; doStatus.style.color = 'var(--red)'; } + } } async function loadNetwork() { diff --git a/public_html/index.html b/public_html/index.html index 39e39e0..f13c53c 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -103,7 +103,7 @@
-
JARVIS SERVER 165.22.1.228
+
JARVIS SERVER 10.48.200.211
@@ -143,6 +143,13 @@
+ +
WEB HOST
+
+
CPU
--%
+
RAM
--%
+
DISK
--%
+
@@ -418,12 +425,12 @@ style="position:fixed;top:-9999px;left:-9999px;width:320px;height:240px"> - - - - - - + + + + + +