Module: check_mk
Branch: master
Commit: 870ab6aa45864c4b106e666f791c70aff8af7c89
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=870ab6aa45864c…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Nov 4 12:05:18 2014 +0100
#1202 FIX cisco_power, cisco_temp_perf: Both checks now using a new service description
Both checks are supported by a wide range of cisco devices. Unfortunately the behavior of
the devices is
not always the same. That means this devices not always return the same information via
snamp.
Cause of this problems, it was necessary to change the information what was used as item
for the service description.
After updating the Service description changes and a reinventory is needed.
---
.werks/1202 | 15 +++++++++++++++
ChangeLog | 2 ++
checks/cisco_power | 30 ++++++++++++------------------
checks/cisco_temp_perf | 16 +++-------------
4 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/.werks/1202 b/.werks/1202
new file mode 100644
index 0000000..4264dc2
--- /dev/null
+++ b/.werks/1202
@@ -0,0 +1,15 @@
+Title: cisco_power, cisco_temp_perf: Both checks now using a new service description
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i7
+Date: 1415098852
+Class: fix
+
+Both checks are supported by a wide range of cisco devices. Unfortunately the behavior of
the devices is
+not always the same. That means this devices not always return the same information via
snamp.
+
+Cause of this problems, it was necessary to change the information what was used as item
for the service description.
+
+After updating the Service description changes and a reinventory is needed.
+
diff --git a/ChangeLog b/ChangeLog
index c8b2b6f..5b2aa18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
* 1485 FIX: dell_om_disks, dell_om_esmlog, dell_om_mem, dell_om_processors,
dell_om_sensors: detect more devices...
+ * 1202 FIX: cisco_power, cisco_temp_perf: Both checks now using a new service
description...
+ NOTE: Please refer to the migration notes!
Multisite:
* 1164 FIX: Fixed links from servicegroup overviews to single servicegroups
diff --git a/checks/cisco_power b/checks/cisco_power
index a2cccf8..de8280b 100644
--- a/checks/cisco_power
+++ b/checks/cisco_power
@@ -38,25 +38,19 @@ cisco_power_source = ( '', 'unknown', 'ac',
'dc', 'externalPowerSupply', 'intern
def inventory_cisco_power(info):
for line in info:
# 5 in line[1] means cisco_power_states = notPresent
- if 'RPS NotExist' not in line[0] and line[1] != '5':
- # The field used here (ciscoEnvMonSupplyStatusDescr) can also
- # contain a textual description of the current status.
- # This tryes to remove that information
- try:
- item = line[0].split(',')[0]
- except:
- item = line[0]
- yield item, None
+ if 'RPS NotExist' not in line[1] and line[2] != '5':
+ # There are many types of cisco devices supported by this check
+ # but they all have difrent behaviors. So we have to use OID_END as
+ # item to find a way to match them all.
+ yield line[0], None
def check_cisco_power(item, no_params, info):
- for line in info:
- try:
- convert_item = line[0].split(',')[0]
- except:
- convert_item = line[0]
- if convert_item == item:
- state, source = map(saveint, line[1:3])
- output = 'State: %s, Source: %s' % (cisco_power_states[state],
cisco_power_source[source])
+ for sid, textinfo, state, source in info:
+ state = int(state)
+ source = int(source)
+ if sid == item:
+ output = '%s, State: %s, Source: %s' % \
+ (textinfo, cisco_power_states[state], cisco_power_source[source])
if state == 1:
return 0, "%s" % output
elif state == 2:
@@ -70,7 +64,7 @@ check_info["cisco_power"] = {
'check_function': check_cisco_power,
'inventory_function': inventory_cisco_power,
'service_description': 'Power %s',
- 'snmp_info': ('.1.3.6.1.4.1.9.9.13.1.5.1', [2, 3, 4]),
+ 'snmp_info': ('.1.3.6.1.4.1.9.9.13.1.5.1', [OID_END, 2,
3, 4]),
'snmp_scan_function': \
lambda oid: "cisco" in oid(".1.3.6.1.2.1.1.1.0").lower(),
}
diff --git a/checks/cisco_temp_perf b/checks/cisco_temp_perf
index 5a0ede5..fa619bb 100644
--- a/checks/cisco_temp_perf
+++ b/checks/cisco_temp_perf
@@ -58,26 +58,16 @@ cisco_temp_perf_envmon_states = {
def inventory_cisco_temp_perf(info):
inventory = []
for line in info:
- try:
- name = line[0].split(',')[0]
- except:
- name = line[0]
- if name == "":
- name = line[4]
- inventory.append((name, None))
+ inventory.append((line[4], None))
return inventory
def check_cisco_temp_perf(item, _no_params, info):
for line in info:
- try:
- name = line[0].split(',')[0]
- except:
- name = line[0]
- if name == item or line[4] == item:
+ if line[4] == item:
temp = saveint(line[1])
if temp != 0:
perfdata = [("temp", temp, None, saveint(line[2]) )]
- temptext = ", %d degrees (critical at %d)" % (temp,
saveint(line[2]))
+ temptext = ", %d degrees (%s) (critical at %d)" % (temp,
line[0], saveint(line[2]))
else:
perfdata = []
temptext = ""