Heartbeats, Coming up and suggested checks; Operations menu tidied

Heartbeats: a cron job or script calls /api/heartbeat/<token> (and /start, /fail); the app
alerts when the call is late or the job says it failed. Coming up: one agenda of everything
dated (expiries, warranties, end of support, planned and recurring maintenance, restore tests,
waiting updates), with a dashboard card and an iCalendar feed behind a share link. Suggested
checks: web ports and certificates the app already knows about, added with a click.

Menu: Incidents become Alerts -> History (old /incidents links redirect); new Monitoring group
(Endpoints, Heartbeats, Uptime Kuma); osTicket under Automation, Admin Links under
Infrastructure, Generator under Administration. Also makes the restore-test metrics test follow
the real clock.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-19 21:42:34 +02:00
1 parent c05c847d17
commit 4e0c6927b2
44 files changed
+7092 -75

No files matched your search

+36 -5
View File
@@ -53,6 +53,7 @@ erDiagram
users ||--o{ audit_log : "actor (set null)"
users ||--o{ push_subscriptions : "cascade"
endpoint_checks ||--o{ endpoint_results : "cascade"
heartbeats ||--o{ heartbeat_pings : "cascade"
integration_credentials ||--o{ integrations : "credential (set null)"
integration_credentials ||--o{ dns_providers : "credential (set null)"
dns_providers ||--o{ dns_zones_cache : "cascade"
@@ -66,9 +67,9 @@ erDiagram
integrations ||--o{ alert_tickets : "osTicket used (set null)"
```
Sixteen tables stand alone, with no foreign keys: `settings`, `secrets`,
Seventeen tables stand alone, with no foreign keys: `settings`, `secrets`,
`ipam_entries`, `domains`, `diag_log`, `notification_queue`,
`consistency_ignores`, `tag_definitions`, `share_links`, `maintenance_schedules`, `metrics_tokens`, `event_webhooks`, `alert_incidents`, `dependencies`, `endpoint_checks`, `restore_tests`. `maintenance_windows` and `maintenance_aliases` also have no
`consistency_ignores`, `tag_definitions`, `share_links`, `maintenance_schedules`, `metrics_tokens`, `event_webhooks`, `alert_incidents`, `dependencies`, `endpoint_checks`, `restore_tests`, `heartbeats`. `maintenance_windows` and `maintenance_aliases` also have no
foreign key — see [soft references](#soft-references-not-foreign-keys).
## Tables
@@ -253,7 +254,7 @@ tasks added by hand.
#### `server_links`
Admin-page bookmarks for a server (Dockge, Webmin, Cockpit, …). Shown on the
server's page and summarised under Operations → Admin Links.
server's page and summarised under Infrastructure → Admin Links.
| Column | Type | Notes |
|---|---|---|
@@ -660,6 +661,36 @@ One row per answer, kept for two weeks: uptime, average answer time and the run
| `ok` | bool NOT NULL | |
| `ms`, `message` | integer, text | |
#### `heartbeats`
A job that reports in: it calls `/api/heartbeat/<token>` when it finishes, and the app speaks up when the call doesn't come in time (services/heartbeats.ts).
| Column | Type | Notes |
|---|---|---|
| `id` | integer PK | |
| `name` | text NOT NULL | |
| `token` | text NOT NULL, unique | The secret part of the address (`hb_…`). Kept as it is, not hashed, because the address has to be shown again; all it allows is "I'm alive". |
| `period_minutes`, `grace_minutes` | integer NOT NULL | How often it should report, and how much later is still fine (default 10). |
| `server_id` | integer | Soft reference to the server it runs on, so its maintenance silences the alerts. |
| `enabled` | bool NOT NULL, default true | A switched-off heartbeat still takes calls. |
| `notes` | text | |
| `last_ping_at`, `last_status` | text | When the last call that ended a run came in, and `ok` or `fail`. |
| `last_message`, `last_duration_ms` | text, integer | The note sent with it, and how long the run took when it said it had started. |
| `last_start_at` | text | ISO; the last `/start` call. |
| `ping_count`, `created_at` | integer, text | |
#### `heartbeat_pings`
The recent calls to each heartbeat, for its history; kept two weeks.
| Column | Type | Notes |
|---|---|---|
| `id` | integer PK | |
| `heartbeat_id` | integer NOT NULL | → `heartbeats.id`, deleted with it (indexed with `at`). |
| `at` | text NOT NULL | ISO. |
| `kind` | text NOT NULL | `ok`, `fail` or `start`. |
| `duration_ms`, `message` | integer, text | |
#### `restore_tests`
Each time somebody tried to restore a backup, and how it went. History is kept; the newest per subject is what counts.
@@ -716,7 +747,7 @@ links): the wall display, or a status page. Only a hash of the secret is stored.
| `token_hash` | text NOT NULL, unique | SHA-256 of the secret in the address; the secret itself is shown once and never stored. |
| `token_prefix` | text NOT NULL | The first characters of the secret, to tell links apart in the list. |
| `detail` | text NOT NULL, default `summary` | For a wall: `summary` (numbers only) or `names` (also the names of what is wrong, in maintenance, and the integrations). Not used by a status page. |
| `kind` | text NOT NULL, default `wall` | `wall` or `status`. A status page's address doesn't open the wall, and the other way round. |
| `kind` | text NOT NULL, default `wall` | `wall`, `status` or `calendar` (an iCalendar feed of what is coming up; `detail` says whether it carries names). Each kind's address opens only that kind. |
| `title`, `message` | text | A status page's heading and its optional message; null for a wall. |
| `created_by` | text | The administrator's name at the time. |
| `created_at` | text NOT NULL | |
@@ -820,7 +851,7 @@ a stale value is possible and the app treats it as "nothing there":
- `maintenance_windows.target_id` (→ a server, integration or DNS provider, by `target_type`)
- `maintenance_aliases.target_id` (the same, by `target_type`)
- `endpoint_checks.server_id` (→ a server) and `restore_tests.subject_key` (→ a Proxmox guest, by integration and vmid)
- `endpoint_checks.server_id` and `heartbeats.server_id` (→ a server) and `restore_tests.subject_key` (→ a Proxmox guest, by integration and vmid)
- `dependencies.from_id` and `to_id` (→ a server or integration, by their `_type`)
- `audit_log.target_id`
- `dns_records_cache.zone_id` (→ `dns_zones_cache.zone_id`, same provider)