diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index 7d4fcd25e..39d81ec91 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -37,6 +37,7 @@ export default function () { mem: { used: round(memStats.used - memStats.buffers - memStats.cached), active: round(memStats.active), + total: round(memStats.total), }, net: { rx: round(Math.max(0, netStats.rx_sec)), diff --git a/packages/client/src/pages/admin/overview.metrics.vue b/packages/client/src/pages/admin/overview.metrics.vue index cfd497439..48d407e7d 100644 --- a/packages/client/src/pages/admin/overview.metrics.vue +++ b/packages/client/src/pages/admin/overview.metrics.vue @@ -84,8 +84,8 @@ const diskAvailable = $computed(() => meta.fs.total - meta.fs.used); function onStats(stats) { cpuUsage = stats.cpu; - memUsage = stats.mem.active / meta.mem.total; - memTotal = meta.mem.total; + memUsage = stats.mem.active / stats.mem.total; + memTotal = stats.mem.total; memUsed = stats.mem.active; memFree = memTotal - memUsed; diff --git a/packages/client/src/widgets/server-metric/cpu-mem.vue b/packages/client/src/widgets/server-metric/cpu-mem.vue index ac7e7f7c1..67ed3bc7d 100644 --- a/packages/client/src/widgets/server-metric/cpu-mem.vue +++ b/packages/client/src/widgets/server-metric/cpu-mem.vue @@ -131,7 +131,7 @@ function onStats(connStats) { ]); const memPolylinePointsStats = stats.map((s, i) => [ viewBoxX - (stats.length - 1 - i), - (1 - s.mem.active / props.meta.mem.total) * viewBoxY, + (1 - s.mem.active / s.mem.total) * viewBoxY, ]); cpuPolylinePoints = cpuPolylinePointsStats .map((xy) => `${xy[0]},${xy[1]}`) @@ -153,7 +153,7 @@ function onStats(connStats) { memHeadY = memPolylinePointsStats[memPolylinePointsStats.length - 1][1]; cpuP = (connStats.cpu * 100).toFixed(0); - memP = ((connStats.mem.active / props.meta.mem.total) * 100).toFixed(0); + memP = ((connStats.mem.active / connStats.mem.total) * 100).toFixed(0); } function onStatsLog(statsLog) { diff --git a/packages/client/src/widgets/server-metric/mem.vue b/packages/client/src/widgets/server-metric/mem.vue index 97e7a63ce..da7ecd81e 100644 --- a/packages/client/src/widgets/server-metric/mem.vue +++ b/packages/client/src/widgets/server-metric/mem.vue @@ -26,8 +26,8 @@ let usage: number = $ref(0), free: number = $ref(0); function onStats(stats) { - usage = stats.mem.active / props.meta.mem.total; - total = props.meta.mem.total; + usage = stats.mem.active / stats.mem.total; + total = stats.mem.total; used = stats.mem.active; free = total - used; }