This commit is contained in:
RGJorge
2026-05-08 02:19:45 +00:00
parent 9e1dadafe7
commit 1ee37368bd
23 changed files with 1321 additions and 147 deletions
+9 -2
View File
@@ -18,11 +18,18 @@ export async function pollStats(services: Service[]): Promise<Stats[]> {
const sysDelta =
raw.cpu_stats.system_cpu_usage - raw.precpu_stats.system_cpu_usage;
const cpu =
const onlineCpus = raw.cpu_stats.online_cpus || 1;
const cpuHost =
sysDelta > 0
? (cpuDelta / sysDelta) * (raw.cpu_stats.online_cpus || 1) * 100
? (cpuDelta / sysDelta) * onlineCpus * 100
: 0;
// If container has a CPU limit, show % relative to its allocation
// cpu_quota: 100000 = 1 core; cpuHost: % of one host core
const cpu = svc.cpu_quota > 0
? (cpuHost * 100000 / svc.cpu_quota)
: cpuHost;
const memUsage = raw.memory_stats.usage || 0;
const memLimit = raw.memory_stats.limit || 1;