fix(glances): unable to parse uptime of 1 day (#5226)

This commit is contained in:
Meier Lukas authored and GitHub committed 2026-03-13 14:09:42 +01:00
1 parent 451602d1e6
commit 3091ed6358
1 file changed
+12 -1
@@ -95,7 +95,18 @@ export class GlancesIntegration extends Integration implements ISystemHealthMoni
}
}
const regex = /^(?:(?<days>\d+) days, )?(?<hours>\d+):(?<minutes>\d+):(?<seconds>\d+)$/m;
// Glances is written in python and uses the following code to format uptime:
// from datetime import datetime
// uptime = datetime.now() - datetime.fromtimestamp(1773395580)
// str(uptime).split(".")[0]
// This results in one of the following formats:
// - 71 days, 9:51:35
// - 1 day, 9:50:23
// - 9:51:24
// - 0:22:02
// - 0:00:17
// See https://github.com/nicolargo/glances/blob/4139b10c5c3a98afc67a19ae67d66d2d94d7db6a/glances/plugins/uptime/__init__.py#L58
const regex = /^(?:(?<days>\d+) days?, )?(?<hours>\d+):(?<minutes>\d+):(?<seconds>\d+)$/m;
const allSchema = z.object({
cpu: z.object({