Skip to content

Commit 047416a

Browse files
committed
agent deployment status: remove orphaned files after grace period
CMK-15880 Change-Id: I41443504b7326d5dc7839f71428cd3ba677d04b6
1 parent 3ba6dce commit 047416a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Diff for: cmk/diskspace/abandoned.py

+14
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ def _do_cleanup_central_site(
118118
)
119119
)
120120

121+
# The invocation `cmk-update-agent register --hostname myhost ...` will unconditionally create
122+
# these files, and they can be used afterwards by creating the host. So, a user might first do
123+
# the registration and then the site configuration. However, its is unlikely this file is useful
124+
# after more than a day.
125+
# Note: All these files only exist on the central site. If a host is deleted, then these files
126+
# are deleted via the `delete-host` automation. If a host is moved between sites, then these
127+
# files remain where they are, so diskspace does not need special logic for those cases.
128+
_cleanup_host_directories(
129+
time.time(),
130+
retention_time,
131+
all_hosts,
132+
f"{omd_root}/var/check_mk/agent_deployment/",
133+
)
134+
121135
if cleaned_up_deleted_hosts := cleaned_up - all_hosts:
122136
_do_automation_call(cleaned_up_deleted_hosts, "delete-hosts")
123137
if cleaned_up_remote_hosts := cleaned_up & (all_hosts - local_site_hosts):

Diff for: cmk/gui/wato/_omd_configuration.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,10 @@ def valuespec(self) -> ValueSpec:
338338
"site to another or deleting a host manually from the configuration.<br>"
339339
"The performance data (RRDs) and HW/SW Inventory archive are never deleted "
340340
"during host deletion. They are only deleted automatically when you enable "
341-
"this option and after the configured period."
341+
"this option and after the configured period. "
342+
"This option also affects the retention of `Agent update status` files. "
343+
"These files can be created without a corresponding host, but should "
344+
"be cleaned up after a grace period if the user never creates the host."
342345
),
343346
),
344347
),

0 commit comments

Comments
 (0)