- Endpoints: HTTP, TCP and TLS checks with answer time, uptime and certificate expiry; failures and expiring certificates become alerts and notifications; linked to a server for maintenance and tags - Restore tests: record when a backup was restored and how it went; failed tests always alert, overdue ones with a limit set; shown on the Backup coverage page - Change log: one filterable timeline made from the audit log and the incident record Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
48 lines
1.6 KiB
SQL
48 lines
1.6 KiB
SQL
CREATE TABLE `endpoint_checks` (
|
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
`name` text NOT NULL,
|
|
`kind` text NOT NULL,
|
|
`target` text NOT NULL,
|
|
`port` integer,
|
|
`expect_status` text,
|
|
`keyword` text,
|
|
`insecure` integer DEFAULT false NOT NULL,
|
|
`interval_minutes` integer DEFAULT 5 NOT NULL,
|
|
`timeout_seconds` integer DEFAULT 10 NOT NULL,
|
|
`failures_before_alert` integer DEFAULT 2 NOT NULL,
|
|
`warn_days` integer DEFAULT 14 NOT NULL,
|
|
`server_id` integer,
|
|
`enabled` integer DEFAULT true NOT NULL,
|
|
`last_checked_at` text,
|
|
`last_ok` integer,
|
|
`last_message` text,
|
|
`last_response_ms` integer,
|
|
`cert_expires_at` text,
|
|
`consecutive_failures` integer DEFAULT 0 NOT NULL,
|
|
`last_change_at` text,
|
|
`created_at` text DEFAULT (current_timestamp) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `endpoint_results` (
|
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
`check_id` integer NOT NULL,
|
|
`at` text NOT NULL,
|
|
`ok` integer NOT NULL,
|
|
`ms` integer,
|
|
`message` text,
|
|
FOREIGN KEY (`check_id`) REFERENCES `endpoint_checks`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `endpoint_results_check_idx` ON `endpoint_results` (`check_id`,`at`);--> statement-breakpoint
|
|
CREATE TABLE `restore_tests` (
|
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
`subject_key` text NOT NULL,
|
|
`label` text NOT NULL,
|
|
`tested_at` text NOT NULL,
|
|
`result` text NOT NULL,
|
|
`note` text,
|
|
`tested_by` text,
|
|
`created_at` text DEFAULT (current_timestamp) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `restore_tests_subject_idx` ON `restore_tests` (`subject_key`,`tested_at`); |