Module: check_mk
Branch: master
Commit: 55e36a94e2927c8d884c2eb80508bd83400f5958
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=55e36a94e2927c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 5 09:20:40 2014 +0100
#1681 FIX cmciii_lcp_fans: Skipping non FAN units now; cleaned up check
---
.werks/1681 | 9 +++++++++
ChangeLog | 1 +
checks/cmciii_lcp_fans | 33 +++++++++++++++++++--------------
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/.werks/1681 b/.werks/1681
new file mode 100644
index 0000000..cbe49f1
--- /dev/null
+++ b/.werks/1681
@@ -0,0 +1,9 @@
+Title: cmciii_lcp_fans: Skipping non FAN units now; cleaned up check
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417767611
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index efde51f..a5c5977 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -112,6 +112,7 @@
* 1656 FIX: cisco_vpn_tunnel: Refactored complete check, fixed threshold bugs...
* 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
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 6962c20..136db3a 100644
--- a/checks/cmciii_lcp_fans
+++ b/checks/cmciii_lcp_fans
@@ -25,32 +25,37 @@
# Boston, MA 02110-1301 USA.
def inventory_cmciii_lcp_fans(info):
- if info:
- inventory = []
- for i in range(1,7):
- if info[0][i*4-1].lower() != "off":
- inventory.append((i , None) )
- return inventory
+ inventory = []
+ # FAN infos have 4 elements. Split the single info line we get
+ # into even sized chunks of 4 elements. In some cases there might
+ # be non-fan information in the resulting data like infos about
+ # 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:
+ # FIXME: Why not use the unique name? Maybe recode
+ inventory.append((i+1 , None))
+ return inventory
def check_cmciii_lcp_fans(item, params, info):
lowlevel = int(re.sub(" .*$", "", info[0][0])) # global low
warning
- for i in range(1,7):
+ 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 item == i:
- name = info[0][i*4-3]
- status = info[0][i*4-1].lower()
- rpm = int(info[0][i*4-2].split(" ")[0])
- unit = info[0][i*4-2].split(" ")[1]
+ rpm, unit = value.split(" ", 1)
+ rpm = int(rpm)
sym = ""
- if status == "ok" and rpm >= lowlevel:
+ if status == "OK" and rpm >= lowlevel:
state = 0
- elif ( status == "ok" and rpm < lowlevel ):
+ elif status == "OK" and rpm < lowlevel:
state = 1
sym = "(!)"
else:
state = 2
+ sym = "(!!)"
info_text = "%s RPM: %d%s (limit %d%s)%s, Status %s" \
% (name, rpm, unit, lowlevel, unit, sym, status)
@@ -68,5 +73,5 @@ check_info['cmciii_lcp_fans'] = {
"service_description" : "LCP Fanunit FAN %s",
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").startswith("Rittal LCP") and \
oid(".1.3.6.1.4.1.2606.7.4.2.2.1.3.2.6").startswith("Air.Temperature.DescName"),
- "snmp_info" : ( '.1.3.6.1.4.1.2606.7.4.2.2.1.10.2',
range(34, 59)),
+ "snmp_info" : ( '.1.3.6.1.4.1.2606.7.4.2.2.1.10.2',
range(34, 58)),
}