Module: check_mk
Branch: master
Commit: 7ab4d92bc4847c948ea7a40d627f207ead35afa9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7ab4d92bc4847c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Nov 18 16:32:40 2010 +0100
cisco_temp_perf: Do not crash if device does not send current temperature
---
ChangeLog | 1 +
checks/cisco_temp_perf | 16 +++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 39d657f..9cf7980 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@
* cisco_power: Not using power source as threshold anymore. Improved output
* cisco_fan: Does not inventorize 'notPresent' sensors anymore. Improved
output
* cisco_power: Not using power source as threshold anymore. Improved output
+ * cisco_temp_perf: Do not crash if device does not send current temperature
* tcp_conn_stats: new check for monitoring number of current TCP connections
* blade_*: Added snmp scan functions for better automatic inventory
* blade_bays: Also inventorizes standby blades and has a little more
diff --git a/checks/cisco_temp_perf b/checks/cisco_temp_perf
index 958695c..a76ebec 100644
--- a/checks/cisco_temp_perf
+++ b/checks/cisco_temp_perf
@@ -61,18 +61,24 @@ def inventory_cisco_temp_perf(checkname, info):
def check_cisco_temp_perf(item, params, info):
for line in info:
if line[0] == item:
- temp = int(line[1])
- perfdata = [("temp", temp)]
+ temp = saveint(line[1])
+ if temp != 0:
+ perfdata = [("temp", temp)]
+ temptext = ", %d degrees (critical at %d)" % (temp,
saveint(line[2]))
+ else:
+ perfdata = []
+ temptext = ""
+
state = int(line[3])
statename = cisco_temp_perf_envmon_states.get(state, "(invalid)")
if state == 1:
- return (0, "OK - %s degrees" % temp, perfdata)
+ return (0, "OK - state is normal%s" % temptext, perfdata)
elif state == 2:
- return (0, "WARN - state is %s, %s degrees" % (statename,
temp), perfdata)
+ return (0, "WARN - state is %s%s" % (statename, temptext),
perfdata)
elif state in [ 5, 6 ]:
return (3, "UNKNOWN - state is %s" % statename)
else:
- return (2, "CRIT - state is %s, %d degrees (max is %s)" %
(statename, temp, line[2]), perfdata)
+ return (2, "CRIT - state is %s%s" % (statename, temptext),
perfdata)
return (3, "UNKNOWN - Item %s not found in SNMP data" % item)
check_info['cisco_temp_perf'] = (check_cisco_temp_perf, "%s", 1,
inventory_cisco_temp_perf)