Module: check_mk
Branch: master
Commit: 9457b2f0affa6396874a9803d7966f553954f622
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9457b2f0affa63…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Jun 17 13:06:39 2014 +0200
FIX cisco_temp_sensor: fix to also work with newer IOS versions
---
.werks/622 | 9 +++++++++
ChangeLog | 1 +
checkman/cisco_temp_sensor | 2 +-
checks/cisco_temp_sensor | 10 +++++++---
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/622 b/.werks/622
new file mode 100644
index 0000000..a9e3701
--- /dev/null
+++ b/.werks/622
@@ -0,0 +1,9 @@
+Title: cisco_temp_sensor: fix to also work with newer IOS versions
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i4
+Date: 1403003070
+
+
diff --git a/ChangeLog b/ChangeLog
index d916cb1..b69ccd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* 0936 FIX: agent_ibmsvc: improved error messages on using wrong credentials
* 0621 FIX: zfsget: better filesystem selection and calculation of sizes...
* 0819 FIX: Fixed keepalive termination in case of exceptions during checking...
+ * 0622 FIX: cisco_temp_sensor: fix to also work with newer IOS versions
Multisite:
* 0934 FIX: Logwatch messages with class unknown ( 'u' ) now displayed as
WARN...
diff --git a/checkman/cisco_temp_sensor b/checkman/cisco_temp_sensor
index 2617cc7..40fa03d 100644
--- a/checkman/cisco_temp_sensor
+++ b/checkman/cisco_temp_sensor
@@ -9,7 +9,7 @@ description:
It uses a combination of data from the standardized
sensors MIB and vendor specific information.
- Warning and critical levels are retrieved from the device
+ Upper warning and critical levels are retrieved from the device
via SNMP and thus need not to be configured.
item:
diff --git a/checks/cisco_temp_sensor b/checks/cisco_temp_sensor
index 8fdd45d..7ff3d26 100644
--- a/checks/cisco_temp_sensor
+++ b/checks/cisco_temp_sensor
@@ -138,13 +138,17 @@ def inventory_cisco_temp_sensor(info):
return [ (entry[1], None) for entry
in sensors if entry[1] != None
and entry[2] == '8'
- and len(entry[5]) == 2 ]
+ and ( len(entry[5]) == 2 or len(entry[5]) == 4 ) ]
def check_cisco_temp_sensor(item, _no_params, info):
sensors = parse_cisco_temp_sensor(info)
for id, descr, sensortype, value, sensorstate, levels in sensors:
if item == descr:
- warn, crit = levels
+ warn, crit = levels[0:2]
+ if len(levels) == 4:
+ value = value/10.0
+ warn = warn/10.0
+ crit = crit/10.0
if sensorstate == "2":
return (3, "data from sensor currently not available")
elif sensorstate == "3":
@@ -155,7 +159,7 @@ def check_cisco_temp_sensor(item, _no_params, info):
state = 1
else:
state = 0
- return (state, "%dC (levels at %d/%d)" % (value, warn, crit), [
+ return (state, "%.1fC (levels at %.1f/%.1f)" % (value, warn, crit), [
( "temperature", value, warn, crit ) ])
return (3, "sensor not found in SNMP data")