Module: check_mk
Branch: master
Commit: 4986baf89db74091f5566811a07e6eb6af2b8892
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4986baf89db740…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 9 09:33:03 2014 +0100
#1696 FIX cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be
more robust now
---
.werks/1696 | 9 +++++++++
ChangeLog | 1 +
checks/cisco_temp_sensor | 27 ++++++++++-----------------
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/.werks/1696 b/.werks/1696
new file mode 100644
index 0000000..ff0705d
--- /dev/null
+++ b/.werks/1696
@@ -0,0 +1,9 @@
+Title: cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be
more robust now
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1418113954
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index de3b50c..133ca5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -134,6 +134,7 @@
* 1716 FIX: windows_tasks: consider state SCHED_S_TASK_QUEUED (0x00041325) as OK now
* 1721 FIX: dell_om_mem: Handle formerly unhandled situations with multiple
errors...
* 1695 FIX: brocade_vdx_status: Is now not bein inventorized anymore for devices not
supporting the check
+ * 1696 FIX: cisco_temp_sensor: Cleaned up value scaling (precision) code in check,
should be more robust now
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/cisco_temp_sensor b/checks/cisco_temp_sensor
index cb49d6c..8a61ccc 100644
--- a/checks/cisco_temp_sensor
+++ b/checks/cisco_temp_sensor
@@ -116,27 +116,19 @@ def parse_cisco_temp_sensor(info):
# Create dict with thresholds
thresholds = {}
- for id, sensortype, value, sensorstate in state_info:
- thresholds.setdefault(id, [])
+ for id, sensortype, precision, value, sensorstate in state_info:
+ thresholds.setdefault(id, [])
- for endoid, levels in levels_info:
- # endoid is e.g. 21549.9 or 21459.10
- level = saveint(levels)
- if level > 150:
- level = level / 10
- id, subid = endoid.split('.')
- thresholds.setdefault(id, []).append(level)
+ for endoid, level in levels_info:
+ level = int(level)*(10**int(precision))
+ # endoid is e.g. 21549.9 or 21459.10
+ id, subid = endoid.split('.')
+ thresholds.setdefault(id, []).append(level)
# Create main dictionary (only of temperature sensors)
sensors = []
- for id, sensortype, value, sensorstate in state_info:
- # Poor try to find temperature values, which are given in tenths of degrees.
- # Seems that some new firmware shows this behaviour.
- # A normal temperature sensor has only a range up to
- # 60 degree, so we've chosen 150.
- value = saveint(value)
- if value > 150:
- value = value / 10
+ for id, sensortype, precision, value, sensorstate in state_info:
+ value = int(value)*(10**int(precision))
sensors.append( ( id, descriptions.get(id), sensortype,
value, sensorstate, thresholds[id] ) )
return sensors
@@ -187,6 +179,7 @@ check_info['cisco_temp_sensor'] = {
( ".1.3.6.1.4.1.9.9.91.1.1.1.1", [
OID_END,
1, # Type (see above), 8 = Celsius, 12 = truth value
+ 3, # Precision
4, # Most recent measurement
5, # Status of the sensor 1 == ok, 2 == cannot report, 3
== broken
]),