Patch plans, a monthly report and new-port alerts

Patch plans (Updates -> Patch plans): updates on a schedule, one server at a time, each by an
ordinary update run, stopping at the first failure by default, silencing what depends on a
server while it is updated, with one message at the end.

Monthly report (Operations -> Monthly report, and optionally a message on a day of the month):
availability, incidents, updates, restore tests, backups and renewals for a calendar month,
printable. Backed by daily endpoint figures and a record of renewals.

New ports: the first report with ports is the baseline; a TCP port that begins listening later and
is not noted on the server's Ports card is a warning, cleared by Mark as expected.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-19 23:16:14 +02:00
1 parent ddd0aa622a
commit be6c5552bd
46 files changed
+7836 -26

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
CREATE TABLE `endpoint_daily` (
`check_id` integer NOT NULL,
`day` text NOT NULL,
`total` integer DEFAULT 0 NOT NULL,
`ok` integer DEFAULT 0 NOT NULL,
`ms_sum` integer DEFAULT 0 NOT NULL,
`ms_count` integer DEFAULT 0 NOT NULL,
PRIMARY KEY(`check_id`, `day`),
FOREIGN KEY (`check_id`) REFERENCES `endpoint_checks`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `patch_plan_runs` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`plan_id` integer NOT NULL,
`plan_name` text NOT NULL,
`trigger` text NOT NULL,
`started_by` text,
`status` text NOT NULL,
`message` text,
`items` text DEFAULT '[]' NOT NULL,
`started_at` text NOT NULL,
`finished_at` text,
FOREIGN KEY (`plan_id`) REFERENCES `patch_plans`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `patch_plan_runs_plan_idx` ON `patch_plan_runs` (`plan_id`,`started_at`);--> statement-breakpoint
CREATE INDEX `patch_plan_runs_status_idx` ON `patch_plan_runs` (`status`);--> statement-breakpoint
CREATE TABLE `patch_plans` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`enabled` integer DEFAULT true NOT NULL,
`days` text NOT NULL,
`start_time` text NOT NULL,
`timezone` text NOT NULL,
`tags` text DEFAULT '[]' NOT NULL,
`server_ids` text DEFAULT '[]' NOT NULL,
`integration_id` integer NOT NULL,
`project_id` integer NOT NULL,
`template_id` integer NOT NULL,
`template_name` text NOT NULL,
`limit_from` text DEFAULT 'name' NOT NULL,
`stop_on_failure` integer DEFAULT true NOT NULL,
`only_with_updates` integer DEFAULT true NOT NULL,
`silence_dependents` integer DEFAULT true NOT NULL,
`window_minutes` integer DEFAULT 90 NOT NULL,
`last_run_date` text,
`created_by` text,
`created_at` text DEFAULT (current_timestamp) NOT NULL
);
--> statement-breakpoint
CREATE TABLE `renewals` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`kind` text NOT NULL,
`subject` text NOT NULL,
`at` text NOT NULL,
`from_date` text NOT NULL,
`to_date` text NOT NULL
);
--> statement-breakpoint
CREATE INDEX `renewals_at_idx` ON `renewals` (`at`);--> statement-breakpoint
ALTER TABLE `servers` ADD `port_baseline` text;
--> statement-breakpoint
-- The daily rollup starts with what the endpoint results already hold (they are kept two weeks), so the first report is not blank.
INSERT INTO `endpoint_daily` (`check_id`, `day`, `total`, `ok`, `ms_sum`, `ms_count`)
SELECT `check_id`, substr(`at`, 1, 10), count(*), sum(`ok`), sum(CASE WHEN `ok` = 1 AND `ms` IS NOT NULL THEN `ms` ELSE 0 END), sum(CASE WHEN `ok` = 1 AND `ms` IS NOT NULL THEN 1 ELSE 0 END)
FROM `endpoint_results` GROUP BY `check_id`, substr(`at`, 1, 10);