Add address aliases for the Uptime Kuma maintenance sync, and ignore Kuma's "null"
Uptime Kuma often watches a host by another address than the one it was added with here (a Proxmox host monitored over Tailscale, say). Address aliases on the Maintenance page say that an address belongs to a server, integration or DNS provider, so the sync puts the window there; matching stays exact. Migration 0018 adds maintenance_aliases. Also fixes monitors whose empty hostname/URL/port arrive from Kuma's metrics as the text "null": they were taken as an address, hiding the real URL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e6404371b
commit
44cc9d1cf2
12 files changed
+2239
-14
No files matched your search
@@ -76,6 +76,23 @@ export const maintenanceWindows = sqliteTable("maintenance_windows", {
|
||||
source: text("source"),
|
||||
});
|
||||
|
||||
// An address that Uptime Kuma's monitors use for a thing this app knows by another address (a Tailscale IP for a host added by its LAN
|
||||
// address, say), so a maintenance window in Uptime Kuma lands on the right server, integration or DNS provider. The address is stored as a
|
||||
// bare lowercase host.
|
||||
export const maintenanceAliases = sqliteTable(
|
||||
"maintenance_aliases",
|
||||
{
|
||||
id: integer("id").primaryKey({ autoIncrement: true }),
|
||||
address: text("address").notNull(),
|
||||
targetType: text("target_type").$type<MaintenanceTargetType>().notNull(),
|
||||
targetId: integer("target_id").notNull(), // polymorphic, like maintenance_windows — no FK; an alias whose target was deleted is ignored
|
||||
createdAt: text("created_at")
|
||||
.notNull()
|
||||
.default(sql`(current_timestamp)`),
|
||||
},
|
||||
(table) => [uniqueIndex("maintenance_aliases_unique_idx").on(table.address, table.targetType, table.targetId)],
|
||||
);
|
||||
|
||||
// ─── Settings (key/value) ───────────────────────────────────────────────────
|
||||
|
||||
export const settings = sqliteTable("settings", {
|
||||
|
||||
Reference in new issue
Block a user