Module: check_mk
Branch: master
Commit: 2c1ea330084598afed25176c99a130cb988f490a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2c1ea330084598…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Aug 4 12:05:39 2015 +0200
#2452 FIX cisco_temperature: Fixed handling of scaling
The check now handles scaling codes from the ENTITY-SENSOR-MIB
correctly.
---
.werks/2452 | 11 +++++++++++
ChangeLog | 1 +
checks/cisco_temperature | 45 +++++++++++++++++++++++++--------------------
3 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/.werks/2452 b/.werks/2452
new file mode 100644
index 0000000..68a9086
--- /dev/null
+++ b/.werks/2452
@@ -0,0 +1,11 @@
+Title: cisco_temperature: Fixed handling of scaling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1438682640
+
+The check now handles scaling codes from the ENTITY-SENSOR-MIB
+correctly.
diff --git a/ChangeLog b/ChangeLog
index ef6901a..7c07852 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -97,6 +97,7 @@
* 2490 FIX: synology_disks: treat SSDs with state "not initialized" as OK
if state does not change later
* 2414 FIX: logwatch: now really ignores ignored logwatch lines...
* 2415 FIX: check_mail, check_mail_loop: fixed incorrect POP3 ssl setting (thanks to
Bernhard Schmidt)...
+ * 2452 FIX: cisco_temperature: Fixed handling of scaling...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checks/cisco_temperature b/checks/cisco_temperature
index dc6ad6f..a087ea1 100644
--- a/checks/cisco_temperature
+++ b/checks/cisco_temperature
@@ -30,29 +30,33 @@
# A firmware update on the device fixes this.
# CISCO-ENTITY-SENSOR-MIB::entSensorScale
-# 1:yocto
-# 2:zepto
-# 3:atto
-# 4:femto
-# 5:pico
-# 6:nano
-# 7:micro
-# 8:milli
-# 9:units
-# 10:kilo
-# 11:mega
-# 12:giga
-# 13:tera
-# 14:exa
-# 15:peta
-# 16:zetta
-# 17:yotta
-#
+
+cisco_entity_exponents = {
+ "1" : -24, # 1:yocto
+ "2" : -21, # 2:zepto
+ "3" : -18, # 3:atto
+ "4" : -15, # 4:femto
+ "5" : -12, # 5:pico
+ "6" : -9, # 6:nano
+ "7" : -6, # 7:micro
+ "8" : -3, # 8:milli
+ "9" : 0, # 9:units
+ "10" : 3, # 10:kilo
+ "11" : 6, # 11:mega
+ "12" : 9, # 12:giga
+ "13" : 12, # 13:tera
+ "14" : 18, # 14:exa
+ "15" : 15, # 15:peta
+ "16" : 21, # 16:zetta
+ "17" : 24, # 17:yotta
+}
+
# CISCO-ENTITY-SENSOR-MIB::entSensorStatus
# 1:ok
# 2:unavailable
# 3:nonoperational
+
def parse_cisco_temperature(info):
description_info, state_info, levels_info, perfstuff = info
@@ -86,8 +90,9 @@ def parse_cisco_temperature(info):
else:
entity_parsed[descr] = {}
scale = 10**int(magnitude)
- if scalecode == '8':
- scale *= 1000
+
+ scale *= 10 ** (-1 * cisco_entity_exponents[scalecode])
+
entity_parsed[descr]['temp'] = float(value) / scale
if len(thresholds[sensor_id]) in [ 2, 4 ]: