Module: check_mk
Branch: master
Commit: 67d2c878ac7b411bb702f1d9b2ecb1b85467d479
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=67d2c878ac7b41…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Nov 29 12:22:01 2013 +0100
brocade_mlx: Temperature sensors of one module now in one common check
Up to now, in Brocade MLX devices, each temperature sensor got an own check.
Now the temperature sensors of one module are grouped together in one
common check and one common PNP graph. Should improve readability.
---
.werks/83 | 10 ++++
ChangeLog | 3 +-
checks/brocade_mlx | 54 ++++++++++++++------
pnp-templates/check_mk-brocade_mlx.temperature.php | 47 ++++++++++++++++-
4 files changed, 97 insertions(+), 17 deletions(-)
diff --git a/.werks/83 b/.werks/83
new file mode 100644
index 0000000..8bac6a0
--- /dev/null
+++ b/.werks/83
@@ -0,0 +1,10 @@
+Title: brocade_mlx: Temperature sensors of one module now in one common check
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1385723866
+Class: feature
+
+Up to now, in Brocade MLX devices, each temperature sensor got an own check.
+Now the temperature sensors of one module are grouped together in one
+common check and one common PNP graph. Should improve readability.
diff --git a/ChangeLog b/ChangeLog
index 4926984..cf3af12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,8 +26,9 @@
* 0099 apc_mod_pdu_modules: New check for APC Modular Power Distribution Unit
* 0072 cmciii_pu_access cmciii_pu_canbus cmciii_pu_io cmciii_pu_temp: New checks for
the Rittal CMC-III PU Unit
* 0100 juniper_cpu: New check for CPU utilization on Juniper switches
- * 0101 liebert_chiller_status: New check for Liebert Chiller devices
* 0236 windows_agent: each script can now be configured to run sync / async...
+ * 0101 liebert_chiller_status: New check for Liebert Chiller devices
+ * 0083 brocade_mlx: Temperature sensors of one module now in one common check...
* 0024 FIX: cisco_wlc: removed check configuration parameter ap_model...
* 0003 FIX: ps: Remove exceeding [ and ] in service description when using process
inventory...
* 0037 FIX: checkman browser (cmk -m) was not working properly in network subtree...
diff --git a/checks/brocade_mlx b/checks/brocade_mlx
index 025c73d..104d1bc 100644
--- a/checks/brocade_mlx
+++ b/checks/brocade_mlx
@@ -30,7 +30,8 @@ brocade_mlx_info = [ ('.1.3.6.1.4.1.1991.1.1.1.2.1.1', [ 1, 2, 3
]), # power sup
# 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)
- ('.1.3.6.1.4.1.1991.1.1.2.13.1.1', [ 3, 4 ]), #
temperature sensors (descr, temperature)
+ ('.1.3.6.1.4.1.1991.1.1.2.13.1.1', [ 3, OID_END, 4 ]),
+ # temperature sensors (descr, sensor ID, temperature)
]
def brocade_mlx_scan(oid):
@@ -278,35 +279,58 @@ check_info["brocade_mlx.module_cpu"] = {
brocade_mlx_temperature_default_levels = (50, 60)
+def compose_item(name):
+ name = re.sub(" *temperature", "", name)
+ name = re.sub(", sensor [0-9]+", "", name)
+ return name
+
def inventory_brocade_mlx_temp(info):
inventory = []
- for temp_descr, temp_value in info[4]:
- inventory.append( (temp_descr,
"brocade_mlx_temperature_default_levels") )
+ import pprint; pprint.pprint(info[4])
+ for temp_descr, temp_id, temp_value in info[4]:
+ temp_descr = compose_item(temp_descr)
+ if ((temp_descr, "brocade_mlx_temperature_default_levels") not in
inventory):
+ inventory.append( (temp_descr,
"brocade_mlx_temperature_default_levels") )
return inventory
def check_brocade_mlx_temp(item, params, info):
warn, crit = params
- for temp_descr, temp_value in info[4]:
- # Info from the MIB: "Each unit is 0.5 degrees Celcius."
- temp_value = int(saveint(temp_value) / 2)
- if temp_descr == item:
+ status = 0
+ message = ""
+ perfdata = []
- status = 0
- if temp_value > warn:
+ for temp_descr, temp_id, temp_value in info[4]:
+ # Info from the MIB: "Each unit is 0.5 degrees Celcius."
+ temp_value = int(temp_value) / 2
+ current_item = compose_item(temp_descr)
+ if current_item == item:
+ # OID_END needs to be used for sensor id because especially
+ # Active management modules may have more temperature sensors
+ # with the same description
+ temp_id = re.sub("[0-9]+\.", "", temp_id)
+ #print "%s : %s : %s" % (temp_descr, temp_id, temp_value);
+
+ if (message != ""):
+ message += ", "
+ message += "Sensor %s: %s°C" % (temp_id, temp_value)
+ if temp_value > warn and status < 1:
status = 1
- if temp_value > crit:
+ message += "(!)"
+ if temp_value > crit and status < 2:
status = 2
+ message += "(!!)"
- perfdata = [ ('temperature', str(temp_value) + 'C', warn,
crit, '', '') ]
-
- return status, "Temperature is %s°C" % temp_value, perfdata
+ perfdata.append( ('sensor%s' % temp_id, str(temp_value) +
'C', warn, crit, '', '') )
- return 3, "temp supply %s not found" % item
+ if (message == ""):
+ return 3, "Temperature sensors for %s not found" % item
+ else:
+ return status, message, perfdata
check_info["brocade_mlx.temperature"] = {
"check_function" : check_brocade_mlx_temp,
"inventory_function" : inventory_brocade_mlx_temp,
- "service_description" : "%s",
+ "service_description" : "Temperature %s",
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
"has_perfdata" : True,
diff --git a/pnp-templates/check_mk-brocade_mlx.temperature.php
b/pnp-templates/check_mk-brocade_mlx.temperature.php
deleted file mode 120000
index fd89bc4..0000000
--- a/pnp-templates/check_mk-brocade_mlx.temperature.php
+++ /dev/null
@@ -1 +0,0 @@
-check_mk-dell_powerconnect_temp.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-brocade_mlx.temperature.php
b/pnp-templates/check_mk-brocade_mlx.temperature.php
new file mode 100644
index 0000000..eb9cfbd
--- /dev/null
+++ b/pnp-templates/check_mk-brocade_mlx.temperature.php
@@ -0,0 +1,46 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+$opt[1] = "--vertical-label $UNIT[1] --slope-mode -l0 -u 45 --title \"" .
$this->MACRO['DISP_HOSTNAME'] . ' / ' .
$this->MACRO['DISP_SERVICEDESC'] . "\" -w 600";
+
+$line_colors = array( "5f7a2f", "2f8077", "2f5580",
"662f80", "802f71", "802f36", "804b2f",
"80762f");
+$def[1] = "";
+
+foreach ($NAME as $i => $n) {
+ $def[1] .= "DEF:$n=$RRDFILE[$i]:$DS[1]:AVERAGE ";
+}
+foreach ($NAME as $i => $n) {
+ $ii = $i % 8;
+ $def[1] .= "LINE:$n#$line_colors[$ii]:\"$n\" ";
+ $def[1] .= "GPRINT:$n:LAST:\"Cur\: %.0lf C \" ";
+ $def[1] .= "GPRINT:$n:AVERAGE:\"Avg\: %.0lf C \" ";
+ $def[1] .= "GPRINT:$n:MIN:\"Min\: %.0lf C \" ";
+ $def[1] .= "GPRINT:$n:MAX:\"Max\: %.0lf C \\n\" ";
+}
+
+$def[1] .= "HRULE:$WARN[1]#ffe000:\"Warning at $WARN[1] C\" ";
+$def[1] .= "HRULE:$CRIT[1]#ff0000:\"Critical at $CRIT[1] C \\n\" ";
+
+?>