The script has been remade.
switchcpu_default_levels = (80.0, 90.0)
def check_switchcpu(item, params, info):
data = (info).split("(")[1].split(")")[0].strip().replace("%","")
util = float(data)
infotext = "CPU utilization" + str(util)
warn, crit = params
perfdata = [("util", util, warn, crit, 0, 100)]
if util >= crit:
return (2, infotext + " (critical at %d%%)" % crit, perfdata)
elif util >= warn:
return (1, infotext + " (warning at %d%%)" % warn, perfdata)
else:
return (0, infotext, perfdata)
check_info['switchcpu'] = {
'check_function' : check_switchcpu,
'inventory_function' : lambda info: [(None, "switchcpu_default_levels")],
'service_description' : 'CPU utilization',
'snmp_info': ('.1.3.6.1.4.1.4526.11.1.1.4', ["9"]),
'snmp_scan_function' : lambda oid: True,
"group" : "cpu_utilization",
"has_perfdata" : True,
}
With this i get an error in the web panel.