Module: check_mk
Branch: master
Commit: c34f0476b3425972c2d2f6cd7f897ee9568c4773
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c34f0476b34259…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Mar 1 15:25:40 2016 +0100
#3255 FIX apc_inrow_temp: fixed wrong discovery handling of available sensors
---
.werks/3255 | 10 ++++++
ChangeLog | 1 +
checks/apc_inrow_temp | 93 +++++++++++++++++++------------------------------
3 files changed, 46 insertions(+), 58 deletions(-)
diff --git a/.werks/3255 b/.werks/3255
new file mode 100644
index 0000000..3cd1295
--- /dev/null
+++ b/.werks/3255
@@ -0,0 +1,10 @@
+Title: apc_inrow_temp: fixed wrong discovery handling of available sensors
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456842114
+
+
diff --git a/ChangeLog b/ChangeLog
index 34e38aa..2a84e11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,7 @@
* 3084 FIX: windows agent: fixed crash when specifying an invalid performance
counter
* 3252 FIX: ntp.time: better handling of temporary synchronization loss...
* 3254 FIX: haproxy: fixed wrong type handling
+ * 3255 FIX: apc_inrow_temp: fixed wrong discovery handling of available sensors
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/apc_inrow_temp b/checks/apc_inrow_temp
index 4e86aa1..4ed7bb7 100644
--- a/checks/apc_inrow_temp
+++ b/checks/apc_inrow_temp
@@ -24,79 +24,56 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# Structure of relevant MIB part (all are integers):
-# airIRRCUnitStatusOperateMode 1.3.6.1.4.1.318.1.1.13.3.2.2.2.1.0
-# airIRRCUnitStatusCoolOutput 1.3.6.1.4.1.318.1.1.13.3.2.2.2.2.0
-# airIRRCUnitStatusCoolDemand 1.3.6.1.4.1.318.1.1.13.3.2.2.2.3.0
-# airIRRCUnitStatusAirFlowUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.4.0
-# airIRRCUnitStatusAirFlowMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.5.0
-# airIRRCUnitStatusRackInletTempUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.6.0
-# airIRRCUnitStatusRackInletTempMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.7.0
-# airIRRCUnitStatusSupplyAirTempUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.8.0
-# airIRRCUnitStatusSupplyAirTempMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.9.0
-# airIRRCUnitStatusReturnAirTempUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.10.0
-# airIRRCUnitStatusReturnAirTempMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.11.0
-# airIRRCUnitStatusContainmtDPUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.12.0
-# airIRRCUnitStatusContainmtDPMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.13.0
-# airIRRCUnitStatusFilterDPUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.14.0
-# airIRRCUnitStatusFilterDPMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.15.0
-# airIRRCUnitStatusFanSpeed 1.3.6.1.4.1.318.1.1.13.3.2.2.2.16.0
-# airIRRCUnitStatusInputState 1.3.6.1.4.1.318.1.1.13.3.2.2.2.17.0
-# airIRRCUnitStatusOutputState 1.3.6.1.4.1.318.1.1.13.3.2.2.2.18.0
-# airIRRCUnitStatusActivePowerSource 1.3.6.1.4.1.318.1.1.13.3.2.2.2.19.0
-# airIRRCUnitStatusFluidValvePosition 1.3.6.1.4.1.318.1.1.13.3.2.2.2.20.0
-# airIRRCUnitStatusFluidFlowUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.21.0
-# airIRRCUnitStatusFluidFlowMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.22.0
-# airIRRCUnitStatusEnteringFluidTemperatureUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.23.0
-# airIRRCUnitStatusEnteringFluidTemperatureMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.24.0
-# airIRRCUnitStatusLeavingFluidTemperatureUS 1.3.6.1.4.1.318.1.1.13.3.2.2.2.25.0
-# airIRRCUnitStatusLeavingFluidTemperatureMetric 1.3.6.1.4.1.318.1.1.13.3.2.2.2.26.0
+
+# .1.3.6.1.4.1.318.1.1.13.3.2.2.2.7.0 197 -->
PowerNet-MIB::airIRRCUnitStatusRackInletTempMetric.0
+# .1.3.6.1.4.1.318.1.1.13.3.2.2.2.9.0 202 -->
PowerNet-MIB::airIRRCUnitStatusSupplyAirTempMetric.0
+# .1.3.6.1.4.1.318.1.1.13.3.2.2.2.11.0 219 -->
PowerNet-MIB::airIRRCUnitStatusReturnAirTempMetric.0
+# .1.3.6.1.4.1.318.1.1.13.3.2.2.2.24.0 131 -->
PowerNet-MIB::airIRRCUnitStatusEnteringFluidTemperatureMetric.0
+# .1.3.6.1.4.1.318.1.1.13.3.2.2.2.26.0 154 -->
PowerNet-MIB::airIRRCUnitStatusLeavingFluidTemperatureMetric.0
+
factory_settings["apc_inrow_temp_default_levels"] = {
"levels": ( 30, 35 )
}
-def apc_inrow_temp_convert(info):
- vars = [
- "Rack Inlet",
- "Supply Air",
- "Return Air",
- "Entering Fluid",
- "Leaving Fluid",
- ]
- count = 0
- data = {}
- for name in vars:
- if len(info) > count and info[count] != "-1":
- value = int(info[count][0])
- data[name] = value / 10.0
- count += 1
- return data
+def parse_apc_inrow_temp(info):
+ parsed = {}
+ for what, what_item in zip(info[0],
+ ["Rack Inlet", "Supply Air", "Return Air",
+ "Entering Fluid", "Leaving Fluid"
+ ]):
+ if what != "" or what != "-1":
+ parsed[what_item] = float(what) / 10
+
+ return parsed
-def inventory_apc_inrow_temp(info):
- if info:
- info = apc_inrow_temp_convert(info)
- for key in info.keys():
- yield key, {}
+def inventory_apc_inrow_temp(parsed):
+ for key in parsed:
+ yield key, {}
-def check_apc_inrow_temp(item, params, info):
- info = apc_inrow_temp_convert(info)
- for sensor, value in info.items():
- if sensor == item:
- return check_temperature(value, params, "apc_inrow_temp_%s" %
item)
+
+def check_apc_inrow_temp(item, params, parsed):
+ if item in parsed:
+ return check_temperature(parsed[item], params, "apc_inrow_temp_%s" %
item)
check_info["apc_inrow_temp"] = {
- "check_function" : check_apc_inrow_temp,
+ "parse_function" : parse_apc_inrow_temp,
"inventory_function" : inventory_apc_inrow_temp,
+ "check_function" : check_apc_inrow_temp,
"service_description" : "Temperature %s",
- "group" : "temperature",
- "snmp_info" : (".1.3.6.1.4.1.318.1.1.13.3.2.2.2", [
7, 9, 11, 24, 26 ]),
- "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3"),
"has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.318.1.1.13.3.2.2.2",
[
+ "7", #
airIRRCUnitStatusRackInletTempMetric
+ "9", #
airIRRCUnitStatusSupplyAirTempMetric
+ "11", #
airIRRCUnitStatusReturnAirTempMetric
+ "24", #
airIRRCUnitStatusEnteringFluidTemperatureMetric
+ "26", #
airIRRCUnitStatusLeavingFluidTemperatureMetric
+ ]),
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3"),
+ "group" : "temperature",
"includes" : [ "temperature.include" ],
"default_levels_variable" : "apc_inrow_temp_default_levels"
}
-