Module: check_mk
Branch: master
Commit: 5222d95e33c4ad53bb83907bdbf69cadf934d33d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5222d95e33c4ad…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Nov 4 14:30:02 2013 +0100
brocade_mlx: added checks for cpu utilization of the non empty NI-MLX modules
---
checks/brocade_mlx | 75 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 72 insertions(+), 3 deletions(-)
diff --git a/checks/brocade_mlx b/checks/brocade_mlx
index 26e99d7..469348e 100644
--- a/checks/brocade_mlx
+++ b/checks/brocade_mlx
@@ -26,8 +26,10 @@
brocade_mlx_info = [ ('.1.3.6.1.4.1.1991.1.1.1.2.1.1', [ 1, 2, 3 ]), # power
supplies (id, descr, state)
('.1.3.6.1.4.1.1991.1.1.1.3.1.1', [ 1, 2, 3 ]), # fans (id,
descr, state)
- ('.1.3.6.1.4.1.1991.1.1.2.2.1.1', [ 1, 2, 12, 24, 25 ]), #
modules
- # (id, descr, overall status, MemoryTotal,
MemoryAvailable)
+ ('.1.3.6.1.4.1.1991.1.1.2.2.1.1', [ 1, 2, 12, 24, 25 ]),
+ # modules (id, descr, overall status, MemoryTotal,
MemoryAvailable)
+ ('.1.3.6.1.4.1.1991.1.1.2.11.1.1.5', [ OID_END, ""
]),
+ # modules (Rest of OId starting with module ID,
CpuUtilPercent)
]
def brocade_mlx_scan(oid):
@@ -135,7 +137,7 @@ check_info["brocade_mlx.module"] = {
# Modules Memory
#############################################################################
-brocade_mlx_mem_default_levels = (70.0, 80.0)
+brocade_mlx_mem_default_levels = (80.0, 90.0)
def inventory_brocade_mlx_module_mem(info):
inventory = []
@@ -183,3 +185,70 @@ check_info["brocade_mlx.module_mem"] = {
"has_perfdata" : True,
}
+#############################################################################
+# Modules CPU Utilization
+#############################################################################
+
+brocade_mlx_cpu_default_levels = (80.0, 90.0)
+
+def inventory_brocade_mlx_module_cpu(info):
+ inventory = []
+ #import pprint; pprint.pprint(info[3])
+ for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
+ # do not inventorize modules reported as empty
+ # and: monitor cpu only on NI-MLX modules
+ if module_state != "0" and
module_descr.startswith("NI-MLX"):
+ # print "module %s" % module_id
+ inventory.append( (combine_item(module_id, module_descr),
"brocade_mlx_cpu_default_levels") )
+ return inventory
+
+def check_brocade_mlx_module_cpu(item, params, info):
+ warn, crit = params
+ for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
+ if combine_item(module_id, module_descr) == item:
+ cpu_util1 = ""
+ cpu_util5 = ""
+ cpu_util60 = ""
+ cpu_util300 = ""
+ for oid_end, cpu_util in info[3]:
+ if oid_end == "%s.1.1" % module_id:
+ cpu_util1 = saveint(cpu_util)
+ if oid_end == "%s.1.5" % module_id:
+ cpu_util5 = saveint(cpu_util)
+ if oid_end == "%s.1.60" % module_id:
+ cpu_util60 = saveint(cpu_util)
+ if oid_end == "%s.1.300" % module_id:
+ cpu_util300 = saveint(cpu_util)
+
+ if cpu_util1 == "" or cpu_util5 == "" or cpu_util60 ==
"" or cpu_util300 == "":
+ return 3, "did not find all cpu utilization values in snmp
output"
+
+ perfdata = [ ('cpu_util1', str(cpu_util1) + '%',
'', '', 0, 100),
+ ('cpu_util5', str(cpu_util5) + '%',
'', '', 0, 100),
+ ('cpu_util60', str(cpu_util60) + '%', warn,
crit, 0, 100),
+ ('cpu_util300', str(cpu_util300) + '%',
'', '', 0, 100),
+ ]
+
+ status = 0
+ errorstring = ""
+ if cpu_util60 > warn:
+ status = 1
+ errorstring = "(!)"
+ if cpu_util60 > crit:
+ status = 2
+ errorstring = "(!!)"
+
+ return status, "CPU Utilization was %s/%s/%s%s/%s%% for the last
1/5/60/300 sec" % \
+ (cpu_util1, cpu_util5, cpu_util60, errorstring, cpu_util300), perfdata
+
+ return 3, "Module %s not found" % item
+
+check_info["brocade_mlx.module_cpu"] = {
+ "check_function" : check_brocade_mlx_module_cpu,
+ "inventory_function" : inventory_brocade_mlx_module_cpu,
+ "service_description" : "Module %s CPU",
+ "snmp_info" : brocade_mlx_info,
+ "snmp_scan_function" : brocade_mlx_scan,
+ "has_perfdata" : True,
+}
+