Nextcloud, NetBox and n8n integrations

Three read-only integrations, each with a monitoring page, alerts, maintenance
silencing and held-when-unreadable handling.

Nextcloud: database needing upgrade (critical), maintenance mode, and the data
disk running low; users, files and app updates with an admin app password.
NetBox: no background worker running, counts, and a list of the servers this
app manages that have no address in NetBox (a list, not an alert).
n8n: an active workflow whose last run failed, clearing when it next succeeds.

Disk messages for Immich, Paperless and Nextcloud now use the same units as
the pages that show them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-24 23:13:13 +02:00
1 parent a16996d975
commit 4ff0b44943
46 files changed
+10137 -10

No files matched your search

+55
View File
@@ -558,6 +558,9 @@ export const integrationTypes = [
"prometheus",
"immich",
"paperless",
"nextcloud",
"netbox",
"n8n",
] as const;
export type IntegrationType = (typeof integrationTypes)[number];
@@ -1164,6 +1167,58 @@ export const haReadings = sqliteTable(
(t) => [index("ha_readings_lookup_idx").on(t.integrationId, t.entityId, t.at)],
);
// ─── Nextcloud ──────────────────────────────────────────────────────────────
// How a Nextcloud (an integration of type "nextcloud") is right now, one row each, replaced at every read: its version, whether it is in maintenance mode or needs its database
// upgrading, and — with an administrator's app password — the room left for the data, the users and files, and the app updates waiting. A column that is null could not be read.
// Read by services/nextcloudSync.ts.
export const nextcloudState = sqliteTable("nextcloud_state", {
integrationId: integer("integration_id")
.primaryKey()
.references(() => integrations.id, { onDelete: "cascade" }),
version: text("version"),
maintenance: integer("maintenance", { mode: "boolean" }).notNull().default(false),
needsUpgrade: integer("needs_upgrade", { mode: "boolean" }).notNull().default(false),
detail: integer("detail", { mode: "boolean" }).notNull().default(false), // whether the monitoring app answered
freeBytes: integer("free_bytes"),
users: integer("users"),
files: integer("files"),
active24h: integer("active_24h"),
appUpdates: integer("app_updates"), // how many apps have an update waiting; null: not asked
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── NetBox ─────────────────────────────────────────────────────────────────
// How a NetBox (an integration of type "netbox") is right now, one row each, replaced at every read: its version, how many background workers are running, the counts and the IP
// addresses it holds (kept so the servers this app manages that are not in it can be listed). A column that is null could not be read. Read by services/netboxSync.ts.
export const netboxState = sqliteTable("netbox_state", {
integrationId: integer("integration_id")
.primaryKey()
.references(() => integrations.id, { onDelete: "cascade" }),
version: text("version"),
workersRunning: integer("workers_running"), // null: /status/ did not say
devices: integer("devices"),
virtualMachines: integer("virtual_machines"),
prefixes: integer("prefixes"),
ipAddresses: integer("ip_addresses"),
ips: text("ips"), // JSON string[] of the addresses (without the prefix length), at most 5000; null: could not be listed
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── n8n ────────────────────────────────────────────────────────────────────
// How an n8n (an integration of type "n8n") is right now, one row each, replaced at every read: its workflows, each with its last outcome and the failures of the last day (worked out
// from the latest 250 runs). Read by services/n8nSync.ts.
export const n8nState = sqliteTable("n8n_state", {
integrationId: integer("integration_id")
.primaryKey()
.references(() => integrations.id, { onDelete: "cascade" }),
workflows: text("workflows").notNull().default("[]"), // JSON: id, name, active, lastStatus, lastAt, failed24h
executionsKnown: integer("executions_known", { mode: "boolean" }).notNull().default(false), // false: the runs could not be asked, so no last outcome is known
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── Paperless-ngx ──────────────────────────────────────────────────────────
// How a Paperless-ngx (an integration of type "paperless") is right now, one row each, replaced at every read: its version, the disk, how each component of its system status is, the