checkmk-plugins/check_mk-juniper_extensions/juniper_mem

36 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/python
juniper_mem_default_levels = (80.0, 90.0)
fruTypesMem = ['Routing Engine', 'FPC', 'PIC']
def inventory_juniper_mem(info):
inventory = []
for line in info:
for fru in fruTypesMem:
if line[0].startswith(fru):
inventory.append((line[0], juniper_mem_default_levels))
return inventory
def check_juniper_mem(item, params, info):
for descr, buffer in info:
if item == descr:
warn, crit = params
util = float(buffer)
infotext = " - %2.1f%% Utilization" % util
perfdata = [("Memory Usage (percent)", util, warn, crit, 0, 100)]
if util >= crit:
return (2, "CRIT" + infotext + " (critical at %d%%)" % crit, perfdata)
elif util >= warn:
return (1, "WARN" + infotext + " (warning at %d%%)" % warn, perfdata)
else:
return (0, "OK" + infotext, perfdata)
return (3, "UNKNOWN")
check_info["juniper_mem"] = {
"check_function" : check_juniper_mem,
"inventory_function" : inventory_juniper_mem,
"service_description" : "Memory Usage",
"has_perfdata" : True,
"snmp_scan_function" : lambda oid: "Juniper" in oid(".1.3.6.1.4.1.2636.3.1.2.0"),
"snmp_info" : ( ".1.3.6.1.4.1.2636.3.1.13.1", ["5", "11"]),
}