Custom SNMP Check Plugin

Good Morning,

I am creating a check_mk snmp plugin and it is not returning anything to me, strange that I have one exactly the same and it works perfectly.

This works:
def inventory_sms2_name(produto):
inventory = []
if len(produto) > 0 and len(produto[0]) > 0:
inventory.append((“produto”,[]))
return inventory

def check_sms2_name(item, params, produto):
return (0, “Product name: %s - %s - %s - Version: %s” % (produto[0][0].strip(),produto[1][0].strip(),produto[2][0].strip(),produto[3][0].strip()))

check_info[“check_sms2_name”] = {
“check_function” : check_sms2_name,
“inventory_function” : inventory_sms2_name,
“service_description” : “NAME %s”,
“snmp_info” : ( “.1.3.6.1.2.1.33.1”, [ “1” ] )
}
Result:

check_mk --checks=check_sms2_name --debug -nvp Nobreak_DC02
Check_MK version 1.6.0p19

  • FETCHING DATA
    [snmp] Execute data source
    [piggyback] Execute data source
    No piggyback files for ‘Nobreak_DC02’. Skip processing.
    No piggyback files for ‘192.168.0.30’. Skip processing.
    NAME produto OK - Product name: Legrand - SMS - SINUS DOUBLE - II - Version: v5.01 Int. ()
    OK - [snmp] Success, execution time 0.4 sec | execution_time=0.364 user_time=0.300 system_time=0.000 children_user_time=0.000 children_system_time=0.010 cmk_time_snmp=0.055 cmk_time_agent=0.003

And this not works correctly:

def inventory_sms2_stat(produto):
inventory = []
if len(produto) > 0 and len(produto[0]) > 0:
inventory.append((“produto”,[]))
return inventory

def check_sms2_stat(item, params, produto):
return (0, “Product name: %s - %s - %s - Version: %s” % (produto[0][0].strip(),produto[1][0].strip(),produto[2][0].strip(),produto[3][0].strip()))

check_info[“check_sms2_stat”] = {
“check_function” : check_sms2_stat,
“inventory_function” : inventory_sms2_stat,
“service_description” : “NAME %s”,
“snmp_info” : ( “.1.3.6.1.2.1.33.1”, [ “1” ] )
}

Result:
check_mk --checks=check_sms2_stat --debug -nvp Nobreak_DC02
Check_MK version 1.6.0p19

  • FETCHING DATA
    [snmp] Execute data source
    [piggyback] Execute data source
    No piggyback files for ‘Nobreak_DC02’. Skip processing.
    No piggyback files for ‘192.168.0.30’. Skip processing.
    OK - [snmp] Success, execution time 0.4 sec | execution_time=0.359 user_time=0.300 system_time=0.000 children_user_time=0.000 children_system_time=0.010 cmk_time_snmp=0.055 cmk_time_agent=0.003

Any tips on where to look?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.