feat(host_agent): a group's updates and reboots on a weekly cadence, one host at a time (#5768)
#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>
This commit is contained in:
@@ -138,6 +138,10 @@ ACTIONS = {
|
||||
"host.created": "added host",
|
||||
"host.renamed": "renamed host",
|
||||
"host_agent.maintenance": "started maintenance (update, reboot if needed) on host",
|
||||
"host_agent.maintenance_plan_created": "added maintenance plan",
|
||||
"host_agent.maintenance_plan_toggled": "paused or resumed maintenance plan",
|
||||
"host_agent.maintenance_plan_deleted": "deleted maintenance plan",
|
||||
"host_agent.maintenance_plan_run": "ran maintenance plan now",
|
||||
"host.deleted": "deleted host",
|
||||
"monitor.created": "added monitor",
|
||||
"monitor.updated": "changed monitor",
|
||||
|
||||
@@ -16,6 +16,8 @@ from __future__ import annotations
|
||||
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",
|
||||
@@ -39,7 +41,7 @@ EXCLUDED: frozenset[str] = frozenset({
|
||||
# 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_jobs", "host_maintenance_runs",
|
||||
"email_outbox", "email_outbox_events", "password_resets",
|
||||
# Run history; its logs live on disk, not in the database.
|
||||
"ansible_runs",
|
||||
|
||||
@@ -345,6 +345,7 @@ METRICS: dict[str, tuple[str, str]] = {
|
||||
"updates_pending": ("Updates waiting", "packages the host's package manager would upgrade, checked hourly"),
|
||||
"updates_security": ("Security updates waiting", "of the updates waiting, those from a security source"),
|
||||
"reboot_required": ("Reboot required", "1 when the host needs a reboot to finish an update, 0 when not"),
|
||||
"maintenance_failed": ("Maintenance failed", "1 when the host's latest scheduled or manual update failed, timed out or didn't come back into service"),
|
||||
}
|
||||
|
||||
# Where a rule's metric comes from, as the picker and the rules list say it.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
{% if session.user_role == 'admin' %}
|
||||
<a class="btn btn-ghost" href="/plugins/host_agent/fleet/">Agent fleet</a>
|
||||
{% endif %}
|
||||
<a class="btn btn-ghost" href="/plugins/host_agent/maintenance">Maintenance</a>
|
||||
{% if can_add %}
|
||||
<button type="button" class="btn" onclick="document.getElementById('add-host').showModal()">Add host</button>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user