-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjuniper_mem
45 lines (38 loc) · 1.64 KB
/
juniper_mem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
# OIDs used:
# JUNIPER-MIB::jnxOperatingDescr .1.3.6.1.4.1.2636.3.1.13.1.5
# JUNIPER-MIB::jnxOperatingBuffer .1.3.6.1.4.1.2636.3.1.13.1.11
# JUNIPER-MIB::jnxBoxDescr .1.3.6.1.4.1.2636.3.1.2.0
# Scan function looks for 'Juniper' in jnxBoxDescr
# Author: Mike Julian - [email protected] - http://mikejulian.com
juniper_mem_default_levels = (80.0, 90.0)
def inventory_juniper_mem(info):
fruTypesMem = ['Routing Engine', 'FPC', 'PIC']
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"]),
}