Hi Everyone,
I am very excited about the new version but I have problem with the checks which were working on the 1.6 version. For one of the checks it’s not visible in the checks and for the another it says:
Here I am pasting this one which has to be converted, don’t know where the problem is:
#!/usr/bin/env python
import csv
edge_router_default_bw_values = (1.0, 2.0, 3.0)
def inventory_check_vpls(info):
for index,name,description,adminStatus,peerCount in info:
try:
newName=name+" - " + Services[name]
yield newName,"edge_router_default_bw_values"
except:
yield name, "edge_router_default_bw_values"
def check_vpls(item, params, info):
Services={}
with open('/opt/omd/sites/epsmon/SOF.csv', mode='r') as infile:
reader = csv.reader(infile)
for row in reader:
serviceName=row[33]
customerName=row[10]
Services.update({serviceName:customerName})
bad,ok,worse = paramsi
for index,name,description,adminStatus,peerCount in info:
if item==name or name in item:
print (name, peerCount)
try:
customerName=Services[name]
except:
customerName=""
if "1"=="1":
if int(peerCount)!=0:
return 0,"VPLS Instance is UP, Description: %s, CUSTOMER: %s"%(description,customerName)
else:
return 2,"VPLS Instance is DOWN - %s"%(customerName)
check_info["check_vpls"] = {
"check_function" : check_vpls,
"inventory_function" : inventory_check_vpls,
"service_description" : "VPLS : %s",
"snmp_info" : ( ".1.3.6.1.4.1.2636.5.8.1", [ "2.1.1","2.1.2","2.1.3","2.1.4","3.1.2" ] ),
"has_perfdata" : False,
"group" : "vpls",
}
And here is the other one which is not showing at all:
#!/usr/bin/env python
edge_router_default_bw_values = (1.0, 2.0, 3.0)
def inventory_check_lsp(info):
counter=0
for name, state,age,timeUp,primaryTimeUp,lastTransition,configuredPaths,operationalPaths in info:
counter+=1
name=name.replace('\x00','')
yield name, "edge_router_default_bw_values"
def convertToHours(millis):
millis = int(millis)*10
seconds=(millis/1000)%60
seconds = int(seconds)
minutes=(millis/(1000*60))%60
minutes = int(minutes)
hours=(millis/(1000*60*60))%24
stringTime= ("%d:%d:%d" % (hours, minutes, seconds))
return stringTime
def check_check_lsp(item, params, info):
bad,ok,worse = params
counter=0
for name,state,age,timeUp,primaryTimeUp,lastTransition,configuredPaths,operationalPaths in info:
counter+=1
name=name.replace('\x00','')
stringTimeUp=convertToHours(timeUp)
stringPrimaryTimeUp=convertToHours(primaryTimeUp)
if item==name:
perfdata=int(state)
if configuredPaths==operationalPaths:
if state=="1":
return 1,"LSP Status is Unknown, Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
if state=="2":
return 0,"LSP is UP, Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
if state=="3":
return 2,"LSP is Down, Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
if state=="5":
return 1,"Backup LSP Is Active, Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
else:
if state=="1":
return 1,"LSP Status is Unknown (Operational Paths not equal Configured Paths), Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
if state=="2":
return 1,"LSP is UP - (Operational Paths not equal Configured Paths), Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
if state=="3":
return 2,"LSP is Down (Operational Paths not equal Configured Paths), Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
if state=="5":
return 1,"Backup LSP Is Active (Operational Paths not equal Configured Paths), Time Up: %s, Primary Time Up: %s" %(stringTimeUp,stringPrimaryTimeUp)
check_info["check_lsp"] = {
"check_function" : check_check_lsp,
"inventory_function" : inventory_check_lsp,
"service_description" : "LSP : %s",
"snmp_info" : ( ".1.3.6.1.4.1.2636.3.2.5.1", [ "1","2","5", "6", "7", "9", "12", "14" ] ),
"has_perfdata" : False,
"group" : "lsp",
}
I really don’t know what the problem is and every help will be much appreciated!