Module: check_mk
Branch: master
Commit: 7f6f3c58a4e0e1fd3a036ce70c0afe9dd0b4f602
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7f6f3c58a4e0e1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Sep 19 13:48:20 2018 +0200
6601 FIX fsc_sc2_fans, fsc_sc2_psu: Discover fans and PSUs if they are present
Change-Id: I159e05d6c8e7dfdad9a3e130e9bfc6d2cc62b570
---
.werks/6601 | 11 +++++++++++
checks/fsc_sc2_fans | 11 +++++------
checks/fsc_sc2_psu | 15 +++++++++------
3 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/.werks/6601 b/.werks/6601
new file mode 100644
index 0000000..4e7f176
--- /dev/null
+++ b/.werks/6601
@@ -0,0 +1,11 @@
+Title: fsc_sc2_fans, fsc_sc2_psu: Discover fans and PSUs only if present
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1537357667
+
+
diff --git a/checks/fsc_sc2_fans b/checks/fsc_sc2_fans
index 48286b3..e3bda1c 100644
--- a/checks/fsc_sc2_fans
+++ b/checks/fsc_sc2_fans
@@ -52,7 +52,8 @@ factory_settings['fan_fsc_sc2_levels'] = {
def inventory_fsc_sc2_fans(info):
for line in info:
- yield line [0], {}
+ if line[1] not in ["8"]:
+ yield line[0], {}
def check_fsc_sc2_fans(item, params, info):
@@ -68,17 +69,15 @@ def check_fsc_sc2_fans(item, params, info):
}
if type(params) == tuple:
- params = { 'lower' : params }
+ params = {'lower': params}
for designation, status, rpm in info:
if designation == item:
- # in this case booth values are important
+ yield status_map.get(status, (3, 'Status is unknown'))
if rpm:
yield check_fan(int(rpm), params)
else:
- yield 3, "Device did not deliver rpm values"
-
- yield status_map.get(status, (3, 'Status is unknown'))
+ yield 0, "Device did not deliver RPM values"
check_info["fsc_sc2_fans"] = {
diff --git a/checks/fsc_sc2_psu b/checks/fsc_sc2_psu
index 2dc13dd..47e59d8 100644
--- a/checks/fsc_sc2_psu
+++ b/checks/fsc_sc2_psu
@@ -35,19 +35,20 @@
def inventory_fsc_sc2_psu(info):
for line in info:
- yield line [0], None
+ if line[1] not in ["2"]:
+ yield line [0], None
def check_fsc_sc2_psu(item, _no_params, info):
psu_status = {
'1' : (3, 'Status is unknown'),
- '2' : (0, 'Status is not-present'),
+ '2' : (1, 'Status is not-present'),
'3' : (0, 'Status is ok'),
'4' : (2, 'Status is failed'),
'5' : (2, 'Status is ac-fail'),
'6' : (2, 'Status is dc-fail'),
'7' : (2, 'Status is critical-temperature'),
- '8' : (0, 'Status is not-manageable'),
+ '8' : (1, 'Status is not-manageable'),
'9' : (1, 'Status is fan-failure-predicted'),
'10': (2, 'Status is fan-failure'),
'11': (1, 'Status is power-safe-mode'),
@@ -58,11 +59,13 @@ def check_fsc_sc2_psu(item, _no_params, info):
for designation, status, load, nominal in info:
if designation == item:
yield psu_status.get(status, (3, 'Status is unknown'))
-
if nominal and load:
- yield 0, 'Nominal load: {0} W, Actual load: {1}
W'.format(nominal, load), [('power', int(load))]
+ infotext = 'Nominal load: %s W, Actual load: %s W' % (nominal,
load)
+ perfdata = [('power', int(load))]
else:
- yield 1, 'Did not receive load data'
+ infotext = 'Did not receive load data'
+ perfdata = []
+ yield 0, infotext, perfdata
check_info["fsc_sc2_psu"] = {