diff --git a/app/api/routes.py b/app/api/routes.py index 87f803c..df4bbd8 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -196,7 +196,11 @@ async def get_cluster_status( "cpu_overcommit_percent": cpu_overcommit_percent, "memory_overcommit_percent": memory_overcommit_percent, "namespaces_in_overcommit": namespaces_in_overcommit, - "resource_quota_coverage": resource_quota_coverage + "resource_quota_coverage": resource_quota_coverage, + "cpu_capacity": cpu_capacity if 'cpu_capacity' in locals() else 0, + "cpu_requests": cpu_requests if 'cpu_requests' in locals() else 0, + "memory_capacity": memory_capacity if 'memory_capacity' in locals() else 0, + "memory_requests": memory_requests if 'memory_requests' in locals() else 0 } } diff --git a/app/static/index.html b/app/static/index.html index 88ae3f3..e92e041 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -198,6 +198,17 @@ .metric-card.success { border-left-color: #27ae60; } + + .metric-value { + cursor: help; + position: relative; + } + + .metric-value:hover { + background-color: #e3f2fd; + border-radius: 4px; + padding: 2px 4px; + } /* Status Overview */ .status-overview { @@ -827,11 +838,11 @@

📊 Cluster Overcommit Summary

-
-
+
-
CPU Overcommit
-
-
+
-
Memory Overcommit
@@ -1053,8 +1064,24 @@ // Update overcommit metrics if (data.overcommit) { - document.getElementById('cpuOvercommit').textContent = `${data.overcommit.cpu_overcommit_percent}%`; - document.getElementById('memoryOvercommit').textContent = `${data.overcommit.memory_overcommit_percent}%`; + // CPU Overcommit with detailed tooltip + const cpuElement = document.getElementById('cpuOvercommit'); + cpuElement.textContent = `${data.overcommit.cpu_overcommit_percent}%`; + if (data.overcommit.cpu_capacity && data.overcommit.cpu_requests) { + const cpuCapacity = data.overcommit.cpu_capacity; + const cpuRequests = data.overcommit.cpu_requests; + cpuElement.title = `CPU Overcommit Details:\n• Capacity Total: ${cpuCapacity} cores\n• Requests Total: ${cpuRequests} cores\n• Overcommit: ${data.overcommit.cpu_overcommit_percent}% (${cpuRequests} ÷ ${cpuCapacity} × 100)`; + } + + // Memory Overcommit with detailed tooltip + const memoryElement = document.getElementById('memoryOvercommit'); + memoryElement.textContent = `${data.overcommit.memory_overcommit_percent}%`; + if (data.overcommit.memory_capacity && data.overcommit.memory_requests) { + const memoryCapacityGB = (data.overcommit.memory_capacity / (1024**3)).toFixed(1); + const memoryRequestsGB = (data.overcommit.memory_requests / (1024**3)).toFixed(1); + memoryElement.title = `Memory Overcommit Details:\n• Capacity Total: ${data.overcommit.memory_capacity.toLocaleString()} bytes (≈ ${memoryCapacityGB} GB)\n• Requests Total: ${data.overcommit.memory_requests.toLocaleString()} bytes (≈ ${memoryRequestsGB} GB)\n• Overcommit: ${data.overcommit.memory_overcommit_percent}% (${memoryRequestsGB} ÷ ${memoryCapacityGB} × 100)`; + } + document.getElementById('namespacesInOvercommit').textContent = data.overcommit.namespaces_in_overcommit || 0; document.getElementById('resourceQuotaCoverage').textContent = `${data.overcommit.resource_quota_coverage}%`; } else {