Catch up on the latest product updates, best practices, and expert insights from the Checkmk Conference #12 – Watch the livestream recordings now

Werk #18322: HW/SW inventory: Integrate label picker

Component HW/SW inventory
Title HW/SW inventory: Integrate label picker
Date Aug 29, 2025
Level Trivial Change
Class New Feature
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
3.0.0b1
Not yet released
Checkmk Community, Checkmk Pro, Checkmk Ultimate, Checkmk Cloud, Checkmk Ultimate MT

The new rule HW/SW inventory label picker offers a configuration for picking host labels from HW/SW inventory trees. The labels are picked by the Check_MK HW/SW Inventory service, so a host needs this service for the picked labels to be created and kept up to date.

For this you need to know the path and the keys or columns to data fields which you want to use for labels. These can be looked up on the HW/SW inventory page of a host by enabling Modify display options > Show internal tree paths.

How it works

  • On each successful run the Check_MK HW/SW Inventory service evaluates the rule on the new inventory tree and records the resulting host labels (prefixed with the configured label name prefix, e.g. cmk/inventory/product). A failed run keeps the previously picked labels.
  • The Check_MK HW/SW Inventory service compares the picked labels with the accepted ones and reports new, vanished and changed labels - each at a state configurable in the rule set Do HW/SW inventory (defaults: new WARN, vanished OK, changed WARN, as for the labels of discovery plug-ins) - until the service discovery accepts them. The Check_MK Discovery service only reports the labels of discovery plug-ins.
  • The service discovery page offers to accept the picked labels. If the periodic service discovery of the host updates host labels, the Check_MK HW/SW Inventory service schedules it, so the labels are accepted automatically - and activated, if the periodic service discovery activates changes. From then on you can use them in rule conditions, views and searches like any other host label.
  • Removing the rule, or a value that no longer matches, makes the picked label vanish with the next inventory run. It is reported as vanished until the service discovery removes it.
  • A host label of a discovery plug-in takes precedence over a picked label of the same name, e.g. cmk/os_family picked with an empty label name prefix: the service discovery keeps the plug-in label, and the Check_MK HW/SW Inventory service keeps reporting the picked label as new. Choose a prefix or label name that no discovery plug-in uses.

Configuration options

Each rule entry groups its options into Inventory source (what to pick) and Label naming (how to name the labels).

Inventory source:

  • Inventory categories: The internal tree path to the node to read from (e.g. software.os).

  • Labels from single values: Pick a label from a single attribute value (Key of the value), named via Label name.

  • Labels from table columns: Pick labels from a table. Column of the value selects the column whose value is used for the label. Rows lets you restrict the considered rows to those whose column matches a regular expression - so you can match on one column and emit the value of another. A host label has a single value: if several rows yield a value for the same label, the first row in table order determines it.

If several configurations or entries yield the same label name, the first one wins; within a configuration, single values come before table columns.

For both, the Label value controls how the selected value is turned into a label value: use it verbatim, use it only if it matches a regular expression, or replace it via an ordered list of Replacement rules. The replacement rules are evaluated in order and the first matching rule is applied: the value is replaced by the rule's Replacement, in which \1, \2, ... refer to the groups of the regular expression; the rule is rejected if it refers to a group the regular expression does not have. The value is dropped if no rule matches.

How values are matched

  • Inventory categories, Key of the value, Column of the value and Column to match must name the internal tree path, keys and columns exactly - they are case-sensitive and are not regular expressions.

  • Matching always works on the raw value stored in the inventory tree, not on the value as displayed. Before matching, the raw value is converted to a string, and this string is also what the label value is made from: a size is matched as 1073741824, not as 1 GiB, a boolean as True or False, not as Yes or No, and a number as 1.5, not as 1.50. With Show internal tree paths enabled, the HW/SW inventory page shows the raw value in brackets behind each displayed value.

  • A regular expression matches if it is found anywhere in the value, e.g. Server matches Microsoft Windows Server 2019. Anchor it with ^ and $ to match the whole value. Matching is case-sensitive; prefix the expression with (?i) to ignore the case.

  • A Replacement replaces the whole value, not only the matched part: with Microsoft Windows Server (.*) and Win Server \1, the value Microsoft Windows Server 2019 Standard becomes Win Server 2019 Standard.

  • Letter case is applied afterwards, to the resulting label value, so the regular expressions always see the value in its original case.

  • A missing key or column, an empty value, and a value that does not match or is replaced by an empty text all pick no label.

Label naming:

  • Label name prefix (empty for none): The prefix the picked labels are stored under (default cmk/inventory).

  • Letter case: Optionally normalize the case of the label name and/or the label value (Keep, Lowercase, Uppercase) for consistent labels. The prefix is kept as entered.

Examples:

Labels from single values

Labels from products

Enter the following internal tree path to the Inventory categories input field:

hardware.system

Then add an entry of Labels from single values and enter

  • product to the Label name input field

  • product to the Key of the value input field

  • choose The value in the dropdown Label value

Labels from operation system names

  • Inventory categories: Add software.os

  • Label name: Add os_name

  • Key of the value: Add name

  • Label value: Choose A replacement (first matching rule wins), enter Microsoft Windows Server (.*) in the Regular expression input field and Win Server \1 in the Replacement input field.

Labels from table columns

Labels as webservers

Enter the internal tree path to the Inventory categories input field:

software.packages

Then add an entry of Labels from table columns and enter

  • Label name: Add webserver

  • Column of the value: Add name

  • Rows: Choose Rows where a column matches, add name to the Column to match input field and (apache|nginx|httpd) to the Regular expression input field.

  • Label value: Choose The value.

This adds the host label cmk/inventory/webserver with the name of the first installed package whose name matches the expression as its value.

Webserver version (matching one column, emitting another)

Because Column of the value and Rows are independent, you can match on one column and use the value of a different column. To label hosts with the version of their installed webserver package:

  • Inventory categories: Add software.packages

  • Label name: Add webserver_version

  • Column of the value: Add version

  • Rows: Choose Rows where a column matches, add name to the Column to match input field and (apache|nginx|httpd) to the Regular expression input field.

  • Label value: Choose The value.

To the list of all Werks