Hello,
I,ve tried to use your function and copied most of it for now my function is called 2try and it partially working… - Below is the function but the problem with it is that now it gives name LSP 0, LSP1 ,LSP2, etc but the text it’s always the first entry of the array (test or info).
When I print the array ( test) the output is the full list of LSP with different names.
When I print in the loop it always prints the first name. Don’t know where my mystake is …
#!/usr/bin/env python
factory_settings['axing_default_levels'] = (60,70)
def inventory_2try(info):
counter=0
**test=[]**
for line in info:
**test.append(line)**
yield str(counter), "axing_default_levels"
counter+=1
def check_2try(name, params, test):
warn, crit = params
status = 0
**print test**
for name,state in test:
print "Name: " +name
print "State: "+state
if state=="2":
status = 0
infotext="LSP IS UP: " + name
# return 0 , name
else:
status = 2
infotext="LSP IS DOWN: " +name
# return 3, name
return 0, infotext
check_info["2try"] = {
"check_function" : check_2try,
"inventory_function" : inventory_2try,
"service_description" : "LSP %s",
"default_levels_variable" : "axing_default_levels",
"has_perfdata" : True,
}
snmp_info["2try"]=( ".1.3.6.1.4.1.2636.3.2.5.1", [ "1","2" ]) ```