Module: check_mk
Branch: master
Commit: 055f1d232392d76e41ed3e0cf44b8684b82bb84b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=055f1d232392d7…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Aug 9 17:55:28 2017 +0200
5093 FIX dell_poweredge_temp: Fixed device levels handling if they are empty
Change-Id: I7bc3ec61fac4af4e6890e567130ca7db7f20face
---
.werks/5093 | 11 +++++++++++
checks/dell_poweredge_temp | 18 +++++++++++-------
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/.werks/5093 b/.werks/5093
new file mode 100644
index 0000000..e21496a
--- /dev/null
+++ b/.werks/5093
@@ -0,0 +1,11 @@
+Title: dell_poweredge_temp: Fixed device levels handling if they are empty
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1502294014
+
+
diff --git a/checks/dell_poweredge_temp b/checks/dell_poweredge_temp
index ac3112e..4763458 100644
--- a/checks/dell_poweredge_temp
+++ b/checks/dell_poweredge_temp
@@ -44,13 +44,18 @@ def inventory_dell_poweredge_temp(info):
def check_dell_poweredge_temp(item, params, info):
for chassisIndex, Index, StateSettings, Status, Reading, LocationName, \
UpperCritical, UpperNonCritical, LowerNonCritical, LowerCritical in info:
-
if item == dell_poweredge_temp_makeitem(chassisIndex, Index, LocationName):
temp = int(Reading) / 10.0
- warn = int(UpperNonCritical) / 10.0
- crit = int(UpperCritical) / 10.0
- lower_warn = int(LowerNonCritical) / 10.0
- lower_crit = int(LowerCritical) / 10.0
+
+ if UpperNonCritical and UpperCritical:
+ levels = (int(UpperNonCritical) / 10.0, int(UpperCritical) / 10.0)
+ else:
+ levels = None, None
+ if LowerNonCritical and LowerCritical:
+ lower_levels = int(LowerNonCritical) / 10.0, int(LowerCritical) / 10.0
+ else:
+ lower_levels = None, None
+
state_table = {
"1" : ("other", 1),
"2" : ("unknown", 1),
@@ -67,8 +72,7 @@ def check_dell_poweredge_temp(item, params, info):
if state:
yield state, state_txt
yield check_temperature(temp, params, "dell_poweredge_temp_%s" %
item,
- dev_levels=(warn, crit),
- dev_levels_lower=(lower_warn, lower_crit))
+ dev_levels=levels, dev_levels_lower=lower_levels)