Module: check_mk
Branch: master
Commit: 1353f3061bbbba673cf9aceaf04f77f155b1da6e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1353f3061bbbba…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Nov 4 12:29:23 2013 +0100
brocade_mlx: added checks for memory of the non empty NI-MLX modules
---
checks/brocade_mlx | 67 ++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 60 insertions(+), 7 deletions(-)
diff --git a/checks/brocade_mlx b/checks/brocade_mlx
index 1db97d4..26e99d7 100644
--- a/checks/brocade_mlx
+++ b/checks/brocade_mlx
@@ -24,9 +24,10 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-brocade_mlx_info = [ ('.1.3.6.1.4.1.1991.1.1.1.2.1.1', [ 1, 2, 3 ]), # power
supplies
- ('.1.3.6.1.4.1.1991.1.1.1.3.1.1', [ 1, 2, 3 ]), # fans
- ('.1.3.6.1.4.1.1991.1.1.2.2.1.1', [ 1, 2, 12 ]), # modules
+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)
]
def brocade_mlx_scan(oid):
@@ -99,19 +100,19 @@ check_info["brocade_mlx.fan"] = {
}
#############################################################################
-# Modules
+# Modules Overall Status
#############################################################################
def inventory_brocade_mlx_module(info):
inventory = []
- for module_id, module_descr, module_state in info[2]:
+ for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
# do not inventorize modules reported as empty
if module_state != "0":
inventory.append( (combine_item(module_id, module_descr), None) )
return inventory
def check_brocade_mlx_module(item, _no_params, info):
- for module_id, module_descr, module_state in info[2]:
+ for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
if combine_item(module_id, module_descr) == item:
if module_state == "10":
return 0, "Module reports status 10 (running)"
@@ -124,9 +125,61 @@ def check_brocade_mlx_module(item, _no_params, info):
check_info["brocade_mlx.module"] = {
"check_function" : check_brocade_mlx_module,
"inventory_function" : inventory_brocade_mlx_module,
- "service_description" : "Module %s",
+ "service_description" : "Module %s Status",
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
"has_perfdata" : False,
}
+#############################################################################
+# Modules Memory
+#############################################################################
+
+brocade_mlx_mem_default_levels = (70.0, 80.0)
+
+def inventory_brocade_mlx_module_mem(info):
+ inventory = []
+ for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
+ # do not inventorize modules reported as empty
+ # and: monitor memory only on NI-MLX modules
+ if module_state != "0" and
module_descr.startswith("NI-MLX"):
+ inventory.append( (combine_item(module_id, module_descr),
"brocade_mlx_mem_default_levels") )
+ return inventory
+
+def check_brocade_mlx_module_mem(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:
+ mem_avail = saveint(mem_avail)
+ mem_total = saveint(mem_total)
+ mem_used = mem_total - mem_avail
+ mem_used_percent = savefloat(mem_used) / savefloat(mem_total) * 100
+ warn_absolut = int(mem_total * warn / 100)
+ crit_absolut = int(mem_total * crit / 100)
+ perfdata = [ ('memused', str(mem_used) + 'Bytes',
warn_absolut, crit_absolut, 0, mem_total) ]
+
+ status = 0
+ errorstring = ""
+ if mem_used_percent > warn:
+ status = 1
+ errorstring = " (!)"
+ if mem_used_percent > crit:
+ status = 2
+ errorstring = " (!!)"
+
+ return status, "%s Bytes used (%0.1f%%%s) of total %s Bytes" % \
+ (get_bytes_human_readable(mem_used), mem_used_percent, \
+ errorstring, get_bytes_human_readable(mem_total)), \
+ perfdata
+
+ return 3, "Module %s not found" % item
+
+check_info["brocade_mlx.module_mem"] = {
+ "check_function" : check_brocade_mlx_module_mem,
+ "inventory_function" : inventory_brocade_mlx_module_mem,
+ "service_description" : "Module %s Memory",
+ "snmp_info" : brocade_mlx_info,
+ "snmp_scan_function" : brocade_mlx_scan,
+ "has_perfdata" : True,
+}
+