From b7aea1371ceb4b73d968217e94f7c53fa55cf8b8 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Thu, 18 Jun 2026 04:08:54 +0000 Subject: [PATCH] feat: add DO server (web host) monitoring block to JARVIS Server panel - /api/do now includes do_server key with jarvis-do agent metrics (CPU, RAM, disk, uptime from Tailscale-connected DO server agent) - Front page JARVIS SERVER panel has WEB HOST section with live CPU/RAM/DISK bars from DO server agent data - Panel title updated to show 10.48.200.211 (JARVIS VM IP) Co-Authored-By: Claude Sonnet 4.6 --- api/endpoints/do_server.php | 17 +++++++++++++++++ public_html/assets/js/jarvis-app.js | 15 +++++++++++++++ public_html/index.html | 21 ++++++++++++++------- 3 files changed, 46 insertions(+), 7 deletions(-) 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"> - - - - - - + + + + + +