Werk #18049: HW/SW Inventory: Rework housekeeping job

Component HW/SW inventory
Title HW/SW Inventory: Rework housekeeping job
Date Jul 9, 2025
Level Trivial Change
Class Bug Fix
Compatibility Incompatible - Manual interaction might be required
Checkmk versions & editions
2.5.0b1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.4.0p12 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

Previously the inventory archive files were handled by the diskspace cleanup job and the history entries were handled by a separate housekeeping job. There was no cleanup job for the inventory or status data tree file.

Now the HW/SW Inventory has its own housekeeping job and own cleanup parameters below Setup > General > Global settings > Site management > HW/SW Inventory cleanup. The diskspace job does not handle inventory files anymore.

These parameters can be configured per host (explicit match or regex).

  • Remove history entries older than the configured file age.

    This may be useful for hosts with few changes within a long period of time.

  • Remove history entries right after entry number X.

    This may be useful for hosts with many changes within a short period of time.

  • Defensive cleanup strategy: Remove history entries older than the configured file age AND remove history entries right after entry number X. This is enforced for Default cleanup parameters.

    See example below.

  • Offensive cleanup strategy: Remove history entries older than the configured file age OR remove history entries right after entry number X. This is available for For explicit hosts.

    See example below.

A history entry is composed of two subsequent archive files and a delta cache file. The delta cache file may be missing because it was not computed yet.

The default is set to Remove history entries older than 400 days and remove history entries right after entry number 100 for new sites. Existing sites don't have a default.

Similar to the diskspace parameters the HW/SW Inventory housekeeping cleans up abandoned host files which are older than 30 days by default. This parameter is also configurable. Abandoned host files include

  • Inventory tree files

  • Status data tree files

  • Archive files

  • Delta cache files

The deciding timestamp for the cleanup of abandoned host files is the youngest timestamp of these files per host.

The housekeeping job runs once a day.

Examples:

now = 11, history entries = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] (represents the files and their timestamps)

  • Remove history entries older than 6, remove history entries right after entry number 3

    • Intermediate result file age: [5, 4, 3, 2, 1]

    • Intermediate result number of history entries: [7, 6, 5, 4, 3, 2, 1]

    • Result of AND: Remove [5, 4, 3, 2, 1] (it's the intersection of both intermediate results)

    • Result of OR: Remove [7, 6, 5, 4, 3, 2, 1] (it's the union of both intermediate results)

  • Remove history entries older than 4, remove history entries right after entry number 6

    • Intermediate result file age: [7, 6, 5, 4, 3, 2, 1]

    • Intermediate result number of history entries: [4, 3, 2, 1]

    • Result of AND: Remove [4, 3, 2, 1] (it's the intersection of both intermediate results)

    • Result of OR: Remove [7, 6, 5, 4, 3, 2, 1] (it's the union of both intermediate results)

To the list of all Werks