This commit is contained in:
CN-JS-HuiBai
2026-04-04 23:01:15 +08:00
parent 79779d6fcf
commit f3f49f2c8e
3 changed files with 57 additions and 17 deletions

View File

@@ -482,6 +482,7 @@ app.get('/api/metrics/overview', async (req, res) => {
// Aggregate across all sources
let totalServers = 0;
let activeServers = 0;
let cpuUsed = 0, cpuTotal = 0;
let memUsed = 0, memTotal = 0;
let diskUsed = 0, diskTotal = 0;
@@ -491,6 +492,7 @@ app.get('/api/metrics/overview', async (req, res) => {
for (const m of validMetrics) {
totalServers += m.totalServers;
activeServers += m.activeServers || m.totalServers; // Default if missing
cpuUsed += m.cpu.used;
cpuTotal += m.cpu.total;
memUsed += m.memory.used;
@@ -520,6 +522,7 @@ app.get('/api/metrics/overview', async (req, res) => {
res.json({
totalServers,
activeServers,
cpu: {
used: cpuUsed,
total: cpuTotal,