George Pochiscan: Removed obsolete check for juniper_ive and updated checks for 1.6 compatibility.

This commit is contained in:
George Pochiscan 2020-08-04 21:44:25 +03:00
parent f0588db6a9
commit 2d1ab3c193
6 changed files with 205 additions and 0 deletions

View File

@ -0,0 +1,47 @@
#!/usr/bin/python
# OIDs used:
# JUNIPER-MIB::jnxOperatingDescr .1.3.6.1.4.1.2636.3.1.13.1.5
# JUNIPER-MIB::jnxOperatingState .1.3.6.1.4.1.2636.3.1.13.1.6
# JUNIPER-MIB::jnxBoxDescr .1.3.6.1.4.1.2636.3.1.2.0
# Scan function looks for 'Juniper' in jnxBoxDescr
# Author: Mike Julian - mike@mikejulian.com - http://mikejulian.com
def inventory_juniper_chassis(info):
inventory = []
for line in info:
inventory.append((line[0], None))
return inventory
def check_juniper_chassis(item, _no_params, info):
for descr, state in info:
if item == descr:
status = int(state)
if status == 1:
return (1, "CRIT - Status: unknown")
elif status == 2:
return (0, "OK - Status: Running (active)")
elif status == 3:
return (0, "OK - Status: Ready (not active)")
elif status == 4:
return (2, "WARN - Status: Held in reset")
elif status == 5:
return (0, "WARN - Status: Running at full speed (fans only)")
elif status == 6:
return (1, "CRIT - Status: Down/Offline (PSUs only)")
elif status == 7:
return (0, "OK - Status: Standby")
else:
return (3, "UNKNOWN")
return (3, "UNKNOWN")
check_info["juniper_chassis"] = {
"check_function" : check_juniper_chassis,
"inventory_function" : inventory_juniper_chassis,
"service_description" : "Chassis: %s",
"has_perfdata" : False,
"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, 6]),
}

Binary file not shown.

View File

@ -0,0 +1,44 @@
#!/usr/bin/python
factory_settings["juniper_cpu_default_levels"] = {
'levels' : (50.0, 60.0),
}
fruTypesCPU = ['PIC', 'FPC', 'Routing Engine']
def inventory_juniper_cpu(info):
inventory = []
for line in info:
for fru in fruTypesCPU:
if line[0].startswith(fru):
inventory.append((line[0], None))
return inventory
def check_juniper_cpu(item, params, info):
for cpu, utilization in info:
if item == cpu:
util = float(utilization)
infotext = " - %2.1f%% Utilization" % util
if "levels" in params:
warn, crit = params["levels"]
else:
warn, crit = params
perfdata = [("util", 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_cpu"] = {
"check_function" : check_juniper_cpu,
"inventory_function" : inventory_juniper_cpu,
"service_description" : "CPU Utilization: ",
"has_perfdata" : True,
"group" : "cpu_utilization",
"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, 8 ] ),
"default_levels_variable" : "juniper_cpu_default_levels",
}

View File

@ -0,0 +1,35 @@
#!/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"]),
}

View File

@ -0,0 +1,29 @@
#!/usr/bin/python
def inventory_juniper_processes(info):
inventory = []
for line in info:
if line[0].startswith("mgd"):
continue
elif line[0].startswith("sshd"):
continue
else:
inventory.append((line[0], None))
return inventory
def check_juniper_processes(item, params, info):
for procName, procUsage in info:
if item == procName:
usage = int(procUsage) / 8
perfdata = [ ( "Memory (kB)", usage) ]
return (0, "OK: %s kB Used" % usage, perfdata)
return (3, "UNKNOWN")
check_info["juniper_processes"] = {
"check_function" : check_juniper_processes,
"inventory_function" : inventory_juniper_processes,
"service_description" : "Process",
"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.2.1.54.1.2.3.1", [7, 10]),
}

View File

@ -0,0 +1,50 @@
#!/usr/bin/python
# OIDs used:
# JUNIPER-MIB::jnxOperatingDescr .1.3.6.1.4.1.2636.3.1.13.1.5
# JUNIPER-MIB::jnxOperatingTemp .1.3.6.1.4.1.2636.3.1.13.1.7
# JUNIPER-MIB::jnxOperatingDescr .1.3.6.1.4.1.2636.3.1.2.0
# Author: Mike Julian - mike@mikejulian.com - http://mikejulian.com
factory_settings["juniper_temp_default_levels"] = {
"levels": (25, 28)
}
def inventory_juniper_temp(info):
frus = ['CB', 'Routing Engine', 'FPC', 'Bottom Tray Fan', 'Bottom Fan Tray', 'Top Tray Fan', 'Top Fan Tray', 'PEM']
inventory = []
for line in info:
# Exclude interface cards, as they have no temp sensors
for fru in frus:
if line[0].startswith(fru):
inventory.append((line[0], juniper_temp_default_levels))
return inventory
def check_juniper_temp(item, params, info):
for descr, temp in info:
warn,crit = params["levels"]
if item == descr:
temp = int(temp)
perfdata = [ ( "temp", temp) ]
if temp >= crit:
return (2, "CRIT - Temperature above threshold (%s): %sC" % (crit,temp), perfdata)
elif temp >= warn:
return (1, "WARN - Temperature above threshold (%s): %sC" % (warn,temp), perfdata)
else:
return (0, "OK - Temperature: %sC" % temp, perfdata)
return (3, "UNKNOWN")
check_info["juniper_temp"] = {
"check_function" : check_juniper_temp,
"inventory_function" : inventory_juniper_temp,
"service_description" : "Temp: %s",
"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, 7]),
"group" : "temperature",
"includes" : [ "temperature.include" ],
"default_levels_variable" : "juniper_temp_default_levels"
}