Item data from inventory function not getting passed to check function in checkmk 2.0

Hi, im developing extensions for monitorizing SNMP on checkmk 2.0, i built my plugins on version 1.6 but they are running on legacy mode, my problem is that i cant access data returned by inventory function from check function, item argument is always none, but the item number is passed to the service description so i dont know whats wrong with it

#!/usr/bin/env python3

# factory_settings["DellOS9_10_power"] = {
#     "warn": (999, 999)
#     }

def inventory_DellOS9_10_power(info):
    if info:
        i = 0
        for line in info:
            yield (str(i), None)
            i += 1

def check_DellOS9_10_power(item, params, info):
        i = 0
        for line in info:
            power = line[0]
            power = int(power)
            if str(i) == item:
                status = 0
                if power >= 999:
                    status = 1
                if power >= 999:
                    status = 2
                perfdata = [ ('power', power, 999, 999 ) ]
                return (status, 'Power Usage: ' + str(power), perfdata)
            i += 1
    except ValueError:
        print("Error", ValueError)
        return 2, "No data"

check_info["dellos_power"] = {
    "check_function": check_DellOS9_10_power,
    "inventory_function": inventory_DellOS9_10_power,
    "service_description": "Power Supply: ",
    "has_perfdata": True,
    "snmp_info": (
            "5",  # Power
    "snmp_scan_function": lambda oid: oid(".") != "",

I had the same issue and it turned out that with legacy plugins the item parameter remains None if your inventory function creates multiple services AND your service_description in check_info doesn’t contain a %s parameter in it.

It is a bit misleading that the inventory is still created without error and the service name is silently appended to the check name, but the check function itself works differently.

Anyway, in the example above the only thing you have to do is to replace

    "service_description": "Power Supply: ",


    "service_description": "Power Supply: %s",

After this item will be populated in your check function and it will work.


What an ineresting solution, thank you for taking your time in responding me, ill try to fix it on my plugins to see if i can update to checkmk 2.0 flawlessly