From b2a4dcad1c876703c795587e01012da822a289ff Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 3 Aug 2026 17:41:16 +0200 Subject: [PATCH] fix: revert ineffective Uptime-Kuma paused fix; harden Unraid CPU divisor The Uptime-Kuma status-page API (toPublicJSON) does not emit a status field on monitor objects, so the added status schema field and paused early-return were dead code and did not resolve #6002. Paused monitors stop producing heartbeats and the two consumed endpoints expose no paused signal, so revert the change. Unraid CPU: divide by cpus.length (the array actually being averaged) instead of info.cpu.threads, which is more robust if the two ever disagree, while keeping the SMT over-reporting fix. --- .../src/unraid/unraid-integration.ts | 8 ++++---- .../src/uptime-kuma/uptime-kuma-integration.ts | 17 +---------------- .../src/uptime-kuma/uptime-kuma-types.ts | 1 - 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/packages/integrations/src/unraid/unraid-integration.ts b/packages/integrations/src/unraid/unraid-integration.ts index 403eb8c9f..cbfcb3fc6 100644 --- a/packages/integrations/src/unraid/unraid-integration.ts +++ b/packages/integrations/src/unraid/unraid-integration.ts @@ -37,11 +37,11 @@ export class UnraidIntegration extends Integration implements ISystemHealthMonit const systemInfo = await this.getSystemInformationAsync(); const cpuUtilization = systemInfo.metrics.cpu.cpus.reduce((acc, val) => acc + val.percentTotal, 0); - const cpuCount = systemInfo.info.cpu.threads; + const cpuCount = systemInfo.metrics.cpu.cpus.length; - // We use the thread count (not physical cores) because each logical CPU entry in cpus[] - // represents a thread. Dividing by cores would over-report utilization on SMT systems. - // Guard against zero or negative thread counts to avoid Infinity/NaN. + // Each entry in cpus[] is one logical CPU (thread). Dividing the summed per-thread + // utilization by the thread count (not physical cores) gives the correct average and + // avoids over-reporting on SMT systems. Guard against zero to avoid Infinity/NaN. const cpuUtilizationNormalized = cpuCount > 0 ? cpuUtilization / cpuCount : 0; const totalMemory = systemInfo.info.memory.layout.reduce((acc, layout) => layout.size + acc, 0); diff --git a/packages/integrations/src/uptime-kuma/uptime-kuma-integration.ts b/packages/integrations/src/uptime-kuma/uptime-kuma-integration.ts index adf73317e..ce494e599 100644 --- a/packages/integrations/src/uptime-kuma/uptime-kuma-integration.ts +++ b/packages/integrations/src/uptime-kuma/uptime-kuma-integration.ts @@ -62,24 +62,9 @@ export class UptimeKumaIntegration extends Integration { } private mapMonitor( - monitor: { id: number; name: string; status?: number }, + monitor: { id: number; name: string }, heartbeat: { heartbeatList: Record; uptimeList: Record }, ): UptimeKumaMonitor { - // If the status page reports a monitor status directly, prefer it over heartbeat inference. - // Uptime-Kuma status page returns status=2 for paused monitors, and once paused, - // heartbeats stop arriving so the latest heartbeat may still show "up" from before pausing. - if (monitor.status !== undefined) { - const statusFromPage = uptimeKumaHeartbeatCategoryMap[monitor.status]; - if (statusFromPage === "paused") { - return { - id: monitor.id, - name: monitor.name, - status: "paused", - uptimePercent24h: null, - }; - } - } - const heartbeats = heartbeat.heartbeatList[String(monitor.id)] ?? []; const latestHeartbeat = heartbeats.at(-1); const uptimeKey = `${monitor.id}_24`; diff --git a/packages/integrations/src/uptime-kuma/uptime-kuma-types.ts b/packages/integrations/src/uptime-kuma/uptime-kuma-types.ts index cff42e964..f029754a8 100644 --- a/packages/integrations/src/uptime-kuma/uptime-kuma-types.ts +++ b/packages/integrations/src/uptime-kuma/uptime-kuma-types.ts @@ -19,7 +19,6 @@ export const uptimeKumaHeartbeatCategoryMap: Record