修复下线问题
This commit is contained in:
@@ -279,6 +279,8 @@ async function getOverviewMetrics(url, sourceName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const activeInstances = Array.from(instances.values()).filter(inst => inst.up);
|
||||||
|
|
||||||
// Aggregate
|
// Aggregate
|
||||||
let totalCpuUsed = 0, totalCpuCores = 0;
|
let totalCpuUsed = 0, totalCpuCores = 0;
|
||||||
let totalMemUsed = 0, totalMemTotal = 0;
|
let totalMemUsed = 0, totalMemTotal = 0;
|
||||||
@@ -286,7 +288,7 @@ async function getOverviewMetrics(url, sourceName) {
|
|||||||
let totalNetRx = 0, totalNetTx = 0;
|
let totalNetRx = 0, totalNetTx = 0;
|
||||||
let totalTraffic24hRx = 0, totalTraffic24hTx = 0;
|
let totalTraffic24hRx = 0, totalTraffic24hTx = 0;
|
||||||
|
|
||||||
for (const inst of instances.values()) {
|
for (const inst of activeInstances) {
|
||||||
totalCpuUsed += (inst.cpuPercent / 100) * inst.cpuCores;
|
totalCpuUsed += (inst.cpuPercent / 100) * inst.cpuCores;
|
||||||
totalCpuCores += inst.cpuCores;
|
totalCpuCores += inst.cpuCores;
|
||||||
totalMemUsed += inst.memUsed;
|
totalMemUsed += inst.memUsed;
|
||||||
@@ -306,7 +308,7 @@ async function getOverviewMetrics(url, sourceName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalServers: instances.size,
|
totalServers: activeInstances.length,
|
||||||
cpu: {
|
cpu: {
|
||||||
used: totalCpuUsed,
|
used: totalCpuUsed,
|
||||||
total: totalCpuCores,
|
total: totalCpuCores,
|
||||||
@@ -332,7 +334,7 @@ async function getOverviewMetrics(url, sourceName) {
|
|||||||
tx: totalTraffic24hTx,
|
tx: totalTraffic24hTx,
|
||||||
total: totalTraffic24hRx + totalTraffic24hTx
|
total: totalTraffic24hRx + totalTraffic24hTx
|
||||||
},
|
},
|
||||||
servers: Array.from(instances.values()).map(s => {
|
servers: activeInstances.map(s => {
|
||||||
const { originalInstance, ...rest } = s;
|
const { originalInstance, ...rest } = s;
|
||||||
return rest;
|
return rest;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user