Module: check_mk
Branch: master
Commit: 1b605d38f28f0356d134fe52b2817a76f6dbd6a3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1b605d38f28f03…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Oct 14 09:43:55 2014 +0200
#1184 FIX cisco_power: Fixed detection of item. In some cases the status information was
part of the item
A reinventory is in some cases necessary. Please Check after the Update for {UNKOWN}
states of checks of this check_type
---
.werks/1184 | 10 ++++++++++
ChangeLog | 2 ++
checks/cisco_power | 28 ++++++++++++++++++++--------
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/.werks/1184 b/.werks/1184
new file mode 100644
index 0000000..1839e7f
--- /dev/null
+++ b/.werks/1184
@@ -0,0 +1,10 @@
+Title: cisco_power: Fixed detection of item. In some cases the status information was
part of the item
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1413272472
+Class: fix
+
+A reinventory is in some cases necessary. Please Check after the Update for {UNKOWN}
states of checks of this check_type
+
diff --git a/ChangeLog b/ChangeLog
index 3e77fe0..d124b02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -102,6 +102,8 @@
* 1114 FIX: bluecat_threads: no longer detected on wrong systems...
* 1116 FIX: megaraid_ldisk: now longer raises an exception for adapters with 'No
Virtual Drive Configured'
* 1122 FIX: windows agent: unicode logfile monitoring: now able to detect incomplete
written lines...
+ * 1184 FIX: cisco_power: Fixed detection of item. In some cases the status
information was part of the item...
+ NOTE: Please refer to the migration notes!
Multisite:
* 1066 Implemented Dashboard Designer...
diff --git a/checks/cisco_power b/checks/cisco_power
index 863bf1e..a2cccf8 100644
--- a/checks/cisco_power
+++ b/checks/cisco_power
@@ -36,21 +36,33 @@ cisco_power_states = ('', 'normal', 'warning',
'critical',
cisco_power_source = ( '', 'unknown', 'ac', 'dc',
'externalPowerSupply', 'internalRedundant')
def inventory_cisco_power(info):
- # 5 in line[1] means cisco_power_states = notPresent
- return [ (line[0], '', '""') for line in info if 'RPS
NotExist' not in line[0] and line[1] != '5' ]
+ 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
-def check_cisco_power(item, params, info):
+def check_cisco_power(item, no_params, info):
for line in info:
- if line[0] == item:
+ 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])
if state == 1:
- return (0, "%s" % output)
+ return 0, "%s" % output
elif state == 2:
- return (1, "%s" % output)
+ return 1, "%s" % output
else:
- return (2, "%s" % output)
- return (3, "item not found in snmp data")
+ return 2, "%s" % output