Files
bobbanandClaude Sonnet 5.5 2f082ca5c2 Duplicati: know when a backup failed or has gone quiet
Duplicati reports each operation to a secret address (its own send-http-url option), so
nothing calls Duplicati and no password for it is kept. Each machine is a source; each job
is learned by name and shows its last result, duration, size, changes and a history.
A failed run is a warning (critical from the second in a row); one that has not succeeded
for longer than expected (per job, 2 days by default) is a warning, critical at three
times that. Maintenance on the machine's server silences them; /metrics series added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 21:36:13 +02:00

52 lines
1.9 KiB
SQL

CREATE TABLE `duplicati_backups` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`source_id` integer NOT NULL,
`name` text NOT NULL,
`last_report_at` text,
`last_result` text,
`last_begin` text,
`last_end` text,
`duration_seconds` integer,
`examined_files` integer,
`size_bytes` integer,
`added_files` integer,
`modified_files` integer,
`deleted_files` integer,
`warnings` integer DEFAULT 0 NOT NULL,
`errors` integer DEFAULT 0 NOT NULL,
`message` text,
`last_success_at` text,
`consecutive_failures` integer DEFAULT 0 NOT NULL,
`expected_hours` integer DEFAULT 48 NOT NULL,
`alert` integer DEFAULT true NOT NULL,
`created_at` text DEFAULT (current_timestamp) NOT NULL,
FOREIGN KEY (`source_id`) REFERENCES `duplicati_sources`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `duplicati_backups_name_idx` ON `duplicati_backups` (`source_id`,`name`);--> statement-breakpoint
CREATE TABLE `duplicati_runs` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`backup_id` integer NOT NULL,
`at` text NOT NULL,
`result` text NOT NULL,
`duration_seconds` integer,
`size_bytes` integer,
`files_changed` integer,
`warnings` integer DEFAULT 0 NOT NULL,
`errors` integer DEFAULT 0 NOT NULL,
FOREIGN KEY (`backup_id`) REFERENCES `duplicati_backups`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `duplicati_runs_idx` ON `duplicati_runs` (`backup_id`,`at`);--> statement-breakpoint
CREATE TABLE `duplicati_sources` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`token_hash` text NOT NULL,
`token_prefix` text NOT NULL,
`server_id` integer,
`created_by` text,
`created_at` text DEFAULT (current_timestamp) NOT NULL,
`last_report_at` text
);
--> statement-breakpoint
CREATE UNIQUE INDEX `duplicati_sources_token_hash_unique` ON `duplicati_sources` (`token_hash`);