Report uptime from the agents, and stop the Integrations page overflowing a phone

Linux agent 8 and Windows agent 7 say how long the machine has been up; the
server stores it (migration 0086) and shows it as Up for in the status strip
(left out while offline) and Uptime on the server page.

The Integrations header wraps and its button no longer squeezes, and
.table-responsive is positioned so hidden text in scrolled-off columns cannot
widen the page.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-08 21:50:44 +01:00
1 parent d88a24b33a
commit 41fbbf3467
18 files changed
+9161 -10

No files matched your search

+1
View File
@@ -442,6 +442,7 @@ export const servers = sqliteTable("servers", {
cpuLoadPercent: real("cpu_load_percent"),
memTotalBytes: integer("mem_total_bytes"),
memUsedBytes: integer("mem_used_bytes"),
uptimeSeconds: integer("uptime_seconds"), // how long the host had been up when it last reported
disks: text("disks"), // JSON string: {mount, sizeBytes, usedBytes}[]
listeningPorts: text("listening_ports"), // JSON string: {protocol, port, address, process}[] — what the agent sees bound on the host
lastPortScan: text("last_port_scan"), // JSON string: summary of the most recent network scan from this app
+5
View File
@@ -101,6 +101,11 @@ const systemSchema = z.object({
ip_addresses: z.array(text(100)).transform(cap(200)).optional(),
cpu: z.object({ model: text(200).optional(), cores: z.number().optional(), load_percent: z.number().nullable().optional() }).optional(),
memory: z.object({ total_bytes: z.number().optional(), used_bytes: z.number().optional() }).optional(),
// Lenient like the rest: a figure that makes no sense is dropped, never allowed to cost the agent its report.
uptime_seconds: z
.unknown()
.optional()
.transform((v) => (typeof v === "number" && Number.isFinite(v) && v > 0 && v < 3_000_000_000 ? Math.floor(v) : undefined)),
disks: z
.array(z.object({ mount: text(500), size_bytes: z.number(), used_bytes: z.number() }))
.transform(cap(500))
+2
View File
@@ -382,6 +382,7 @@ serversRouter.get("/:id/detail", asyncHandler(async (req, res) => {
cpuLoadPercent: server.cpuLoadPercent,
memTotalBytes: server.memTotalBytes,
memUsedBytes: server.memUsedBytes,
uptime: server.uptimeSeconds,
disks: server.disks ? JSON.parse(server.disks) : [],
};
} else {
@@ -424,6 +425,7 @@ serversRouter.get("/:id/detail", asyncHandler(async (req, res) => {
cpuLoadPercent: _cpuLoadPercent,
memTotalBytes: _memTotalBytes,
memUsedBytes: _memUsedBytes,
uptimeSeconds: _uptimeSeconds,
listeningPorts: _listeningPorts,
lastPortScan: _lastPortScan,
pendingUpdates: rawUpdates,
+1
View File
@@ -13,6 +13,7 @@
* 5 — Linux: also says what the machine is (maker, model, serial), for the inventory
* 6 — Linux (and Windows 5): also says what it could not collect and why, so the server can say what to fix
* 7 — Linux (and Windows 6): also says which operating system and release it runs, so the server can say when that release stops being supported
* 8 — Linux (and Windows 7): also says how long the machine has been up
*/
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
+4
View File
@@ -24,6 +24,8 @@ export interface IncomingSystemInfo {
ip_addresses?: string[];
cpu?: { model?: string; cores?: number; load_percent?: number | null };
memory?: { total_bytes?: number; used_bytes?: number };
/** Seconds the machine had been up. Absent from an agent that predates it. */
uptime_seconds?: number;
disks?: { mount: string; size_bytes: number; used_bytes: number }[];
listening_ports?: { protocol: "tcp" | "udp"; port: number; address: string; process?: string }[];
/** Updates waiting to be installed. Absent from an agent that doesn't report them (or couldn't find out this time). */
@@ -141,6 +143,8 @@ export async function syncServerTasks(serverId: number, report: AgentReport) {
...(system?.cpu?.load_percent !== undefined ? { cpuLoadPercent: system.cpu.load_percent } : {}),
...(system?.memory?.total_bytes !== undefined ? { memTotalBytes: system.memory.total_bytes } : {}),
...(system?.memory?.used_bytes !== undefined ? { memUsedBytes: system.memory.used_bytes } : {}),
// Only stored when said, so an agent that predates this doesn't wipe it.
...(system?.uptime_seconds !== undefined ? { uptimeSeconds: system.uptime_seconds } : {}),
...(system?.disks
? {
disks: JSON.stringify(