#5768 "A maintenance cadence: a group's updates and reboots, one host at a time, on a schedule". A plan names an inventory group, a weekday and time in a time zone, a window and a reboot policy (only when required by default). At its slot a run takes the group's hosts in order and gives each a #5767 maintenance job. The next host starts only when the last is back in service: its agent is posting and, for a swarm node, the node is active and every replicated service is at its replicas. A failure stops the run, and no host is started once the window has passed. A host's latest failure shows as host_agent/<host>/maintenance_failed, for an ordinary alert rule. The page is Hosts → Maintenance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
2.7 KiB
Python
57 lines
2.7 KiB
Python
"""What a backup carries. Every table Steward defines is named here as kept
|
|
or left out, and tests/core/test_backup_contents.py fails on one that is
|
|
neither, so a new table is a decision someone makes in this file.
|
|
|
|
The operator's ruling (System 180 "Backup & Restore", 2026-10-12): a backup
|
|
carries configuration, the audit log and alert history. Metrics, check
|
|
results and the Docker, Traefik and UniFi history are left out: their tables
|
|
come back with their structure and no rows, and fill again as Steward runs.
|
|
|
|
A table that is in neither list (an external plugin's) is backed up whole:
|
|
a table nobody thought about is kept, never lost.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
# Configuration, and the history the operator chose to keep.
|
|
KEPT: frozenset[str] = frozenset({
|
|
"app_settings", "users", "user_invites", "api_tokens",
|
|
"hosts", "host_agent_registrations",
|
|
# A group's maintenance cadence (#5768): configuration.
|
|
"host_maintenance_plans",
|
|
"monitors",
|
|
"alert_rules", "alert_states", "maintenance_windows",
|
|
"ansible_targets", "ansible_groups", "ansible_target_groups", "ansible_schedules",
|
|
"dashboards", "dashboard_widgets", "dashboard_share_tokens",
|
|
"snmp_devices", "prometheus_targets", "prometheus_widget_templates",
|
|
# Names given to network clients by hand (UniFi's alias column).
|
|
"unifi_known_clients",
|
|
# History kept by the ruling.
|
|
"audit_events", "alert_events",
|
|
# Metric anomalies and their reviews (#5740): what someone marked normal
|
|
# or real is a decision, kept like alert history.
|
|
"metric_anomalies", "metric_anomaly_spans",
|
|
})
|
|
|
|
# Rows that are measurements, logs or in-flight work: left out.
|
|
EXCLUDED: frozenset[str] = frozenset({
|
|
"plugin_metrics", "plugin_metric_latest", "plugin_metrics_hourly",
|
|
# Learned from the metrics above, so relearned once they fill again.
|
|
"metric_norms",
|
|
"monitor_results",
|
|
# A host's downtime as its agent reported it: history, like the metrics.
|
|
"host_downtime",
|
|
# Maintenance jobs (#5767): run history, like ansible_runs.
|
|
"host_maintenance_jobs", "host_maintenance_runs",
|
|
"email_outbox", "email_outbox_events", "password_resets",
|
|
# Run history; its logs live on disk, not in the database.
|
|
"ansible_runs",
|
|
"docker_containers", "docker_disk_usage", "docker_events", "docker_host_status",
|
|
"docker_images", "docker_logs",
|
|
"docker_swarm_nodes", "docker_swarm_services",
|
|
"traefik_access_summaries", "traefik_certs", "traefik_global_stats", "traefik_metrics",
|
|
"traefik_status_codes",
|
|
"unifi_alarms", "unifi_client_snapshots", "unifi_devices", "unifi_dpi_snapshots",
|
|
"unifi_events", "unifi_fw_rules", "unifi_networks", "unifi_port_forwards",
|
|
"unifi_speedtest_results", "unifi_wan_stats", "unifi_wlan_stats",
|
|
})
|