Use the Checkmk built-in Datasource

Datasource Specific Parameters

mapping:
  - labelname:  <custom labelname>
    # Comma separated list of the tree structure of the HW/SW Inventory

    # Optional:
    # Allows to define which rows from tables are used by labelpicker 
    # That is needed if the HW / SW Inventory tree ends up in a table
    # and not in a single value, e.g. the Software Packages
    # First item in the list is the label identifier which has to be
    # specified in the tree the second item will be set as label value
    table_row_mapping:
      packages: [name, version]
      routes: [target, gateway]
      interfaces: [index, speed]
      modules: [ manufacturer, model]

    # Example:
    tree: [Software, Operating System, Name]
    # Alternative notation in yaml
    tree:
      - Software
      - Operating System
      - Name <-- can be also regex
    match_group_filters:
        - ["regex search string", "replace string"]

Examples


Label: hwsw/product: VMware Virtual Platform

Tree: Hardware - System - Product

Config

      - labelname: product
        tree: [Hardware, System, Product]

Label: hwsw/apache_version: 2.4.41

Config

      - labelname: apache_version
        tree:
          - Software
          - Packages
          - (?i)(apache|httpd)

Label: hwsw/webserver: true

Config

      - labelname: webserver
        match_group_filters:
          - ['.*', 'true']
        tree:
          - Software
          - Packages
          - (?i)(apache|httpd)

Label: hwsw/manufacturer: HP

Limit values by setting a regex_value_filter

In this example only the manufacturers HP & FUJITSU will be defined as label. “No Enclosure”, O.E.M, etc. will be ignored with this definition
Config

      - labelname: manufacturer
        regex_value_filter: (HP|FUJITSU)
        tree: [Hardware, System, Manufacturer]

Harmonize Labels via Regex match_group_filters

This can be done using match_group_filters. It’s a list of filters, each filter consists of two fields: ["regex search string", "replace string"] In the first field you can define matchgroups. They can be used in the second field with \(numberof the matchgroup)

Full example with some label definitions

datasources:
  Hardware-Software-Inventory:
    module: lpds_hwswtree
    # CMK Label = <label_prefix>/<label>
    # Example label_name: hwsw/os_name
    label_prefix: hwsw
    mapping:
      - labelname: os_name
        tree: [Software, Operating System, Name]
        match_group_filters:
          - ['Microsoft Windows Server (.*)', 'Win Server \1']
      - labelname: product
        tree: [Hardware, System, Product]

      - labelname: model
        tree: [Hardware, System, Model Name]

      - labelname: manufacturer
        regex_value_filter: (HP|FUJITSU)
        tree: [Hardware, System, Manufacturer]

      - labelname: webserver
        match_group_filters:
          - ['.*', 'true']
        tree:
          - Software
          - Packages
          - (?i)(apache|httpd)
       
      - labelname: vnc_server
        match_group_filters:
          - ['.*', 'true']
        tree:
          - Software
          - Packages
          - (?i)vnc
 
      - labelname: tightvnc_version
        tree:
          - Software
          - Packages
          - (?i)tightvnc