Module: check_mk
Branch: master
Commit: a2021effa295d069a9fa25e42aa57ae9a5fee40e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a2021effa295d0…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Nov 7 13:30:43 2013 +0100
Added new checks for Brocade NetIron MLX switching / routing devices
It checks by SNMP
the status of Power supplies and Fans
the overall status of modules
memory usage and cpu utilization of NI-MLX modules
temperature measured by different temperature sensors
---
.werks/80 | 12 ++++++++++++
ChangeLog | 3 ++-
checkman/brocade_mlx.module_cpu | 14 ++++++--------
checkman/brocade_mlx.module_mem | 14 ++++++--------
checks/brocade_mlx | 39 +++++++++++++++++++++------------------
5 files changed, 47 insertions(+), 35 deletions(-)
diff --git a/.werks/80 b/.werks/80
new file mode 100644
index 0000000..b1b5552
--- /dev/null
+++ b/.werks/80
@@ -0,0 +1,12 @@
+Title: Added new checks for Brocade NetIron MLX switching / routing devices
+Level: 2
+Component: checks
+Version: 1.2.3i7
+Date: 1383827175
+Class: feature
+
+It checks by SNMP
+the status of Power supplies and Fans
+the overall status of modules
+memory usage and cpu utilization of NI-MLX modules
+temperature measured by different temperature sensors
diff --git a/ChangeLog b/ChangeLog
index ccc81d3..2b6a53b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,8 +5,9 @@
* 0063 veeam_client: new check to monitor status of veeam clients with special agent
plugin...
* 0064 veeam_jobs: new check to monitor the backup jobs of the veeam backup tool...
* 0047 Add new collection of checks to monitor Fritz!Box devices...
- * 0090 apc_ats_status: New Check for monitoring APC Automatic Transfer Switches...
* 0027 esx_vsphere_sensors: it is now possible override the state of sensors
+ * 0090 apc_ats_status: New Check for monitoring APC Automatic Transfer Switches...
+ * 0080 Added new checks for Brocade NetIron MLX switching / routing devices...
* 0024 FIX: cisco_wlc: removed configuration parameter ap_model...
Multisite:
diff --git a/checkman/brocade_mlx.module_cpu b/checkman/brocade_mlx.module_cpu
index 5a29277..ec8be8b 100644
--- a/checkman/brocade_mlx.module_cpu
+++ b/checkman/brocade_mlx.module_cpu
@@ -20,7 +20,7 @@ item:
examples:
# set default levels to 70 and 80 percent:
- brocade_mlx_cpu_default_levels = (70.0, 80.0)
+ brocade_mlx_cpu_default_levels = { "levels": (70.0, 80.0) }
# Check Module with ID 33 on a box called my-mlx-device with default levels
checks += [
@@ -29,7 +29,7 @@ examples:
# or use individual levels for warn and crit
checks += [
- ("my-mlx-device", "brocade_mlx.module_cpu", '33 NI-MLX-32_MR
Management Module', (75.0, 85.0)),
+ ("my-mlx-device", "brocade_mlx.module_cpu", '33 NI-MLX-32_MR
Management Module', { "levels": (75.0, 85.0) }),
]
perfdata:
@@ -42,11 +42,9 @@ inventory:
Empty modules are omitted.
[parameters]
-warn(float): {WARN} state is triggered, if the CPU utilization in percent is higher
- than this.
-crit(float): {CRIT} state is triggered, if the CPU utilization in percent is higher
- than this.
+parameters (dict): with the element
+{"levels"}: (float, float): levels of CPU utilization for {WARN} and {CRIT} in
percent
[configuration]
-brocade_mlx_cpu_default_levels(float, float): The standard levels for {WARN} and
- {CRIT}. Defaults are (80.0, 90.0)
+brocade_mlx_cpu_default_levels(dict): The standard levels for {WARN} and
+ {CRIT}, preset to { "levels": (80.0, 90.0) }
diff --git a/checkman/brocade_mlx.module_mem b/checkman/brocade_mlx.module_mem
index df88967..bca713b 100644
--- a/checkman/brocade_mlx.module_mem
+++ b/checkman/brocade_mlx.module_mem
@@ -16,7 +16,7 @@ item:
examples:
# set default levels to 70 and 80 percent:
- brocade_mlx_mem_default_levels = (70.0, 80.0)
+ brocade_mlx_mem_default_levels = { "levels": (70.0, 80.0) }
# Check Module with ID 33 on a box called my-mlx-device with default levels
checks += [
@@ -25,7 +25,7 @@ examples:
# or use individual levels for warn and crit
checks += [
- ("my-mlx-device", "brocade_mlx.module_mem", '33 NI-MLX-32_MR
Management Module', (75.0, 85.0)),
+ ("my-mlx-device", "brocade_mlx.module_mem", '33 NI-MLX-32_MR
Management Module', { "levels": (75.0, 85.0) }),
]
perfdata:
@@ -37,11 +37,9 @@ inventory:
Empty modules are omitted.
[parameters]
-warn(float): {WARN} state is triggered, if the memory usage in percent is higher
- than this.
-crit(float): {CRIT} state is triggered, if the memory usage in percent is higher
- than this.
+parameters (dict): with the element
+{"levels"}: (float, float): levels of memory usage for {WARN} and {CRIT} in
percent
[configuration]
-brocade_mlx_mem_default_levels(float, float): The standard levels for {WARN} and
- {CRIT}. Defaults are (80.0, 90.0)
+brocade_mlx_mem_default_levels(dict): The standard levels for {WARN} and
+ {CRIT}, preset to { "levels": (80.0, 90.0) }
diff --git a/checks/brocade_mlx b/checks/brocade_mlx
index 54af612..2a042f8 100644
--- a/checks/brocade_mlx
+++ b/checks/brocade_mlx
@@ -138,7 +138,7 @@ check_info["brocade_mlx.module_status"] = {
# Modules Memory
#############################################################################
-brocade_mlx_mem_default_levels = (80.0, 90.0)
+brocade_mlx_mem_default_levels = { "levels": (80.0, 90.0) }
def inventory_brocade_mlx_module_mem(info):
inventory = []
@@ -150,30 +150,35 @@ def inventory_brocade_mlx_module_mem(info):
return inventory
def check_brocade_mlx_module_mem(item, params, info):
- warn, crit = params
+ warn, crit = params["levels"]
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)
+
+ if type(warn) is int:
+ warn_absolut = warn
+ else:
+ warn_absolut = int(mem_total * warn / 100)
+
+ if type(crit) is int:
+ crit_absolut = crit
+ else:
+ 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:
+ if mem_used > warn_absolut:
status = 1
- errorstring = " (!)"
- if mem_used_percent > crit:
+ if mem_used > crit_absolut:
status = 2
- errorstring = " (!!)"
- return status, "%s used (%0.1f%%%s) of total %s" % \
+ return status, "%s used (%0.1f%%) of total %s" % \
(get_bytes_human_readable(mem_used), mem_used_percent, \
- errorstring, get_bytes_human_readable(mem_total)), \
- perfdata
+ get_bytes_human_readable(mem_total)), perfdata
return 3, "Module %s not found" % item
@@ -184,15 +189,14 @@ check_info["brocade_mlx.module_mem"] = {
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
"has_perfdata" : True,
- # needs something like memory_of_modules
- #"group" : "memory",
+ "group" : "memory_multiitem",
}
#############################################################################
# Modules CPU Utilization
#############################################################################
-brocade_mlx_cpu_default_levels = (80.0, 90.0)
+brocade_mlx_cpu_default_levels = { "levels" : (80.0, 90.0) }
def inventory_brocade_mlx_module_cpu(info):
inventory = []
@@ -204,7 +208,7 @@ def inventory_brocade_mlx_module_cpu(info):
return inventory
def check_brocade_mlx_module_cpu(item, params, info):
- warn, crit = params
+ warn, crit = params["levels"]
for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
if combine_item(module_id, module_descr) == item:
cpu_util1 = ""
@@ -251,8 +255,7 @@ check_info["brocade_mlx.module_cpu"] = {
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
"has_perfdata" : True,
- # needs something like cpu_utilization_of_modules
- #"group" : "cpu_utilization",
+ "group" : "cpu_utilization_multiitem",
}
#############################################################################