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):
try:
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": (
".1.3.6.1.4.1.674.10895.3000.1.2.110.7.2.1",
[
"5", # Power
],
),
"snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") != "",
}