Module: check_mk
Branch: master
Commit: 5973ec56699b697e165637915ff9298ca74ca01f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5973ec56699b69…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 12 13:56:38 2015 +0100
#1809 FIX cisco_temp_perf: Fixed exception when no temperature threshold provided by
device
---
.werks/1809 | 10 +++++++++
ChangeLog | 1 +
checks/cisco_temp_perf | 55 ++++++++++++++++++++++++------------------------
3 files changed, 39 insertions(+), 27 deletions(-)
diff --git a/.werks/1809 b/.werks/1809
new file mode 100644
index 0000000..c060c93
--- /dev/null
+++ b/.werks/1809
@@ -0,0 +1,10 @@
+Title: cisco_temp_perf: Fixed exception when no temperature threshold provided by device
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1421067367
+
+
diff --git a/ChangeLog b/ChangeLog
index 6ec3de3..264e4a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@
* 1840 FIX: oracle_tablespaces: fix implementation of magic factor
* 1848 FIX: df: title of pnp graphs for filesystem checks fixed...
* 1209 FIX: livestatus_status: Check handles cluster using in cluster now
+ * 1809 FIX: cisco_temp_perf: Fixed exception when no temperature threshold provided
by device
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/cisco_temp_perf b/checks/cisco_temp_perf
index 899990f..2f4ee54 100644
--- a/checks/cisco_temp_perf
+++ b/checks/cisco_temp_perf
@@ -24,27 +24,22 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# normal(1): the environment is good, such as low
-# temperature.
-#
-# warning(2): the environment is bad, such as temperature
-# above normal operation range but not too
-# high.
-#
-# critical(3): the environment is very bad, such as
-# temperature much higher than normal
-# operation limit.
-#
-# shutdown(4): the environment is the worst, the system
-# should be shutdown immediately.
-#
-# notPresent(5): the environmental monitor is not present,
-# such as temperature sensors do not exist.
-#
-# notFunctioning(6): the environmental monitor does not
-# function properly, such as a temperature
-# sensor generates a abnormal data like
-# 1000 C.
+# normal(1): the environment is good, such as low
+# temperature.
+# warning(2): the environment is bad, such as temperature
+# above normal operation range but not too
+# high.
+# critical(3): the environment is very bad, such as
+# temperature much higher than normal
+# operation limit.
+# shutdown(4): the environment is the worst, the system
+# should be shutdown immediately.
+# notPresent(5): the environmental monitor is not present,
+# such as temperature sensors do not exist.
+# notFunctioning(6): the environmental monitor does not
+# function properly, such as a temperature
+# sensor generates a abnormal data like
+# 1000 C.
cisco_temp_perf_envmon_states = {
1: "normal",
@@ -62,12 +57,14 @@ def inventory_cisco_temp_perf(info):
def check_cisco_temp_perf(item, _no_params, info):
for statustext, temp, max_temp, state, oid_end in info:
if cisco_sensor_item(statustext, oid_end) == item:
- #FIXE saveint needed here? (See if condition)
+ # FIXME saveint needed here? (See if condition)
temp = saveint(temp)
if temp != 0:
- max_temp = int(max_temp)
+ max_temp = max_temp and int(max_temp) or None
perfdata = [("temp", temp, None, max_temp )]
- temptext = ", %d degrees (critical at %d)" % (temp, max_temp)
+ temptext = ", Temperature: %d °C" % temp
+ if max_temp != None:
+ temptext += " (critical at %d °C)" % max_temp
else:
perfdata = []
temptext = ""
@@ -82,7 +79,6 @@ def check_cisco_temp_perf(item, _no_params, info):
return (3, "state is %s" % statename)
else:
return (2, "state is %s%s" % (statename, temptext), perfdata)
- return (3, "Item %s not found in SNMP data" % item)
check_info['cisco_temp_perf'] = {
@@ -94,8 +90,13 @@ check_info['cisco_temp_perf'] = {
lambda oid: "cisco" in oid(".1.3.6.1.2.1.1.1.0").lower() \
and oid(".1.3.6.1.4.1.9.9.13.1.3.1.3.*") != None \
and oid(".1.3.6.1.4.1.9.9.91.1.1.1.1.*") == None,
- "snmp_info" : ( ".1.3.6.1.4.1.9.9.13.1.3.1",
- [2, 3, 4, 6, OID_END ] ), # CISCO-SMI
+ "snmp_info" : (".1.3.6.1.4.1.9.9.13.1.3.1", [ #
CISCO-SMI
+ 2, # ciscoEnvMonTemperatureStatusDescr
+ 3, # ciscoEnvMonTemperatureStatusValue
+ 4, # ciscoEnvMonTemperatureThreshold
+ 6, # ciscoEnvMonTemperatureState
+ OID_END
+ ]),
"group" : "temperature_auto",
"includes" : ['cisco_sensor_item.include'],
}