Module: check_mk
Branch: master
Commit: f37c8064a9874686a85dc04c4fb47677ce0cc78d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f37c8064a98746…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 5 09:41:20 2014 +0100
#1682 FIX cmciii_lcp_waterflow: Check can now deal with devices with a different setup
---
.werks/1682 | 9 +++++++++
ChangeLog | 1 +
checks/cmciii_lcp_fans | 4 +++-
checks/cmciii_lcp_waterflow | 28 +++++++++++++++++-----------
4 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/.werks/1682 b/.werks/1682
new file mode 100644
index 0000000..bd516f7
--- /dev/null
+++ b/.werks/1682
@@ -0,0 +1,9 @@
+Title: cmciii_lcp_waterflow: Check can now deal with devices with a different setup
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417768851
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 1ca3481..730a68d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -114,6 +114,7 @@
* 1677 FIX: f5_bigip_interfaces: Cleaned up check a bit
* 1679 FIX: ups_bat_temp: Now skipping sensors which are reported to have 0
upsBatteryTemperature
* 1681 FIX: cmciii_lcp_fans: Skipping non FAN units now; cleaned up check
+ * 1682 FIX: cmciii_lcp_waterflow: Check can now deal with devices with a different
setup
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/cmciii_lcp_fans b/checks/cmciii_lcp_fans
index 136db3a..ee884b5 100644
--- a/checks/cmciii_lcp_fans
+++ b/checks/cmciii_lcp_fans
@@ -32,7 +32,7 @@ def inventory_cmciii_lcp_fans(info):
# water cooling. Filter them out.
parts = [ info[0][x+1:x+4] for x in range(0, len(info[0]), 4) ]
for i, (name, value, status) in enumerate(parts):
- if status != "off" and 'Water' not in name:
+ if status != "off" and 'FAN' in name:
# FIXME: Why not use the unique name? Maybe recode
inventory.append((i+1 , None))
return inventory
@@ -42,8 +42,10 @@ def check_cmciii_lcp_fans(item, params, info):
lowlevel = int(re.sub(" .*$", "", info[0][0])) # global low
warning
parts = [ info[0][x+1:x+4] for x in range(0, len(info[0]), 4) ]
+ print parts
for i, (name, value, status) in enumerate(parts):
if item == i:
+ print value
rpm, unit = value.split(" ", 1)
rpm = int(rpm)
diff --git a/checks/cmciii_lcp_waterflow b/checks/cmciii_lcp_waterflow
index 25daa31..36cab53 100644
--- a/checks/cmciii_lcp_waterflow
+++ b/checks/cmciii_lcp_waterflow
@@ -30,28 +30,34 @@ def inventory_cmciii_lcp_waterflow(info):
def check_cmciii_lcp_waterflow(item, params, info):
if info[0]:
- name = info[0][0]
- status = info[0][4]
- flow = float(info[0][1].split(" ")[0])
- unit = info[0][1].split(" ")[1]
- minflow= float(info[0][3].split(" ")[0])
- maxflow = float(info[0][2].split(" ")[0])
+ # We have a list of values where no item has a fixed index. We
+ # try to detect the starting index for the needed values now.
+ try:
+ index = info[0].index('Waterflow')
+ name, flow, maxflow, minflow, status = info[0][index:index+5]
+ except ValueError:
+ return 3, 'Waterflow information not found'
+
+ unit = flow.split(" ", 1)[1]
+ flow = float(flow.split(" ", 1)[0])
+ minflow = float(minflow.split(" ", 1)[0])
+ maxflow = float(maxflow.split(" ", 1)[0])
sym = ""
- if status.lower() != "ok":
+ state = 0
+ if status != "OK":
state = 2
+ sym = "(!!)"
elif flow < minflow or flow > maxflow:
state = 1
sym = "(!)"
- else:
- state = 0
info_text = "%s Status: %s Flow: %.1f%s, MinFlow: %.1f, MaxFLow: %.1f"
\
% (name, status, flow, sym, minflow, maxflow)
perfdata = [ ("flow", str(flow)+unit ,
str(minflow)+":"+str(maxflow), 0, 0 ) ]
- return (state, info_text, perfdata)
+ return state, info_text, perfdata
return (3, "no SNMP data found")
@@ -61,5 +67,5 @@ check_info['cmciii_lcp_waterflow'] = {
"has_perfdata" : True,
"service_description" : "LCP Fanunit WATER FLOW",
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").startswith("Rittal LCP"),
- "snmp_info" : ( '.1.3.6.1.4.1.2606.7.4.2.2.1.10.2',
range(82, 87)),
+ "snmp_info" : ( '.1.3.6.1.4.1.2606.7.4.2.2.1.10.2',
range(74, 87)),
}