Module: check_mk
Branch: master
Commit: 3b75702ed81baf9dd4f7767f7c320a2d17fe23a5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b75702ed81baf…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Mar 13 17:20:50 2017 +0100
4538 FIX blade_bx_powermod: Fixed outdated calculation of state
In the old version of this checkplugin the state "fanmodule" has not been
considered.
Change-Id: I4d2dda3c51b8cfc86c24030af1e9228cd1799ec9
---
.werks/4538 | 10 ++++++++++
checks/blade_bx_powermod | 48 ++++++++++++++++++++++++++----------------------
2 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/.werks/4538 b/.werks/4538
new file mode 100644
index 0000000..2aeda59
--- /dev/null
+++ b/.werks/4538
@@ -0,0 +1,10 @@
+Title: blade_bx_powermod: Fixed outdated calculation of state
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1489421952
+Class: fix
+
+In the old version of this checkplugin the state "fanmodule" has not been
considered.
diff --git a/checks/blade_bx_powermod b/checks/blade_bx_powermod
index 31aa186..a4f4a74 100644
--- a/checks/blade_bx_powermod
+++ b/checks/blade_bx_powermod
@@ -24,34 +24,38 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+def inventory_blade_bx_powermod(info):
+ for line in info:
+ yield (line[0], None)
+
def check_blade_bx_powermod(item, _no_param, info):
power_status = {
- 1 : "unknown",
- 2 : "ok",
- 3 : "not-present",
- 4 : "error",
- 5 : "critical",
- 6 : "off",
- 7 : "dummy",
+ "1" : ("unknown", 3),
+ "2" : ("ok", 0),
+ "3" : ("not-present", 2),
+ "4" : ("error", 2),
+ "5" : ("critical", 2),
+ "6" : ("off", 2),
+ "7" : ("dummy", 2),
+ "8" : ("fanmodule", 0),
}
+ for line in info:
+ index, status, product_name = line
+ if not index == item:
+ continue
+ state_readable, state = power_status[status]
+ return state, "%s Status is %s" % (product_name, state_readable)
- for index, status, product_name in info:
- status = saveint(status)
- if index != item: continue
- state = 0
- if status != 2:
- state = 2
-
- return (state, "%s Status is %s" % (product_name, power_status[status])
)
check_info['blade_bx_powermod'] = {
- "check_function" : check_blade_bx_powermod,
- "inventory_function" : lambda info: [ (line[0], None) for line in info ],
- "service_description" : "Power Module %s",
- "snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.3.2.4.1", [
- 1, # index
- 2, # status
- 4, # product name
+ "inventory_function" : inventory_blade_bx_powermod,
+ "check_function" : check_blade_bx_powermod,
+ "service_description" : "Power Module %s",
+ "snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.3.2.4.1", [
+ 1, # s31SysPowerSupplyUnitId
+ 2, # s31SysPowerSupplyUnitStatus
+ 4, #
s31SysPowerSupplyUnitProductName
]),
"snmp_scan_function" : lambda oid: "BX600" in
oid(".1.3.6.1.2.1.1.1.0") \
or oid(".1.3.6.1.2.1.1.2.0") ==
".1.3.6.1.4.1.7244.1.1.1",