Module: check_mk
Branch: master
Commit: d30b24d248fab154b1decd2be3f5d47d84bcfbdc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d30b24d248fab1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 20 11:01:57 2011 +0200
FIX: cisco_temp_perf: handle sensors without names correctly
---
ChangeLog | 1 +
checks/cisco_temp_perf | 14 ++++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0994c75..4833744 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@
* FIX: fc_brocade_port_detailed: fix PNP template in MULTIPLE mode
* FIX: ad_replication.bat only generates output on domain controllers now.
This is useful to prevent checks on non DC hosts (Thanks to Alex Greenwood)
+ * FIX: cisco_temp_perf: handle sensors without names correctly
* printer_supply: Changed order of tests. When a printer reports -3 this
is used before the check if maxlevel is -2.
* printer_supply: Skipping inventory of supplies which have current value
diff --git a/checks/cisco_temp_perf b/checks/cisco_temp_perf
index aa042ae..e441a1d 100644
--- a/checks/cisco_temp_perf
+++ b/checks/cisco_temp_perf
@@ -56,11 +56,17 @@ cisco_temp_perf_envmon_states = {
}
def inventory_cisco_temp_perf(checkname, info):
- return [ (line[0], None) for line in info if len(line) == 4 ]
+ inventory = []
+ for line in info:
+ name = line[0]
+ if name == "":
+ name = line[4]
+ inventory.append((name, None))
+ return inventory
def check_cisco_temp_perf(item, params, info):
for line in info:
- if line[0] == item:
+ if line[0] == item or line[4] == item:
temp = saveint(line[1])
if temp != 0:
perfdata = [("temp", temp)]
@@ -81,8 +87,8 @@ def check_cisco_temp_perf(item, params, info):
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)
-snmp_info['cisco_temp_perf'] = ( ".1.3.6.1.4.1.9.9.13.1.3.1", [ 2, 3,
4, 6 ] ) # CISCO-SMI
+check_info['cisco_temp_perf'] = (check_cisco_temp_perf, "Temperature
%s", 1, inventory_cisco_temp_perf)
+snmp_info['cisco_temp_perf'] = ( ".1.3.6.1.4.1.9.9.13.1.3.1", [ 2, 3,
4, 6, OID_END ] ) # CISCO-SMI
snmp_scan_functions['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