Module: check_mk
Branch: master
Commit: 7835227c08bf3e4029fb22d84e34d1924b084f29
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7835227c08bf3e…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Feb 8 14:54:24 2017 +0100
4342 FIX hp_proliant: fixed empty status handling
Change-Id: I27cb6ed02b7458f3367187f73198e1599713ed93
---
.werks/4342 | 10 ++++++++++
ChangeLog | 1 +
checks/hp_proliant | 47 +++++++++++++++++++++++++++++------------------
3 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/.werks/4342 b/.werks/4342
new file mode 100644
index 0000000..c70976e
--- /dev/null
+++ b/.werks/4342
@@ -0,0 +1,10 @@
+Title: hp_proliant: fixed empty status handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1486562039
+
+
diff --git a/ChangeLog b/ChangeLog
index 84aabe1..8499bcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -100,6 +100,7 @@
* 4340 FIX: blade_bays: cleanup and some improvements...
* 4341 FIX: cisco_wlc: fixed invalid parameters during service discovery
* 4024 FIX: netapp_api_volumes: fixed incorrect computation of read/write latency
+ * 4342 FIX: hp_proliant: fixed empty status handling
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/checks/hp_proliant b/checks/hp_proliant
index 1b03c68..70a3fc9 100644
--- a/checks/hp_proliant
+++ b/checks/hp_proliant
@@ -24,32 +24,43 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# General Status:
-# '.1.3.6.1.4.1.232.2.2.2.1.0' => Serial Number of Server
-# '.1.3.6.1.4.1.232.11.2.14.1.1.5.0' => cpqHoFwVerVersion
-# '.1.3.6.1.4.1.232.11.1.3.0' => cpqHoMibCondition
-hp_proliant_general_status_map = { 1: 'Unknown', 2: 'Ok',
3: 'Degraded', 4: 'Failed' }
-hp_proliant_general_status2nagios_map = { 'Unknown': 3, 'Ok':
0, 'Degraded': 1, 'Failed': 2, }
+# .1.3.6.1.4.1.232.11.1.3.0 1
+# .1.3.6.1.4.1.232.11.2.14.1.1.5.0 "2009.05.18"
+# .1.3.6.1.4.1.232.2.2.2.1.0 "GB8851CPPH
+
def inventory_proliant_general(info):
if len(info) > 0 and len(info[0]) > 1 and info[0][0]:
return [ (None, None) ]
+
def check_proliant_general(item, no_params, info):
if not info:
- return 3, "status not found in snmp data"
- snmp_state = hp_proliant_general_status_map[int(info[0][0])]
- status = hp_proliant_general_status2nagios_map[snmp_state]
- return (status, "General Status is %s (Firmware: %s, S/N: %s)" %
- (snmp_state, info[0][1], info[0][2]))
+ return 3, "Status not found in snmp data"
+
+ map_states = {
+ "1" : (3, "unknown"),
+ "2" : (0, "OK"),
+ "3" : (1, "degraded"),
+ "4" : (2, "failed"), }
+
+ status, firmware, serial_number = info[0]
+ state, state_readable = map_states.get(status, (3, "unhandled[%s]" %
status))
+ return state, "Status: %s, Firmware: %s, S/N: %s" % \
+ (state_readable, firmware, serial_number)
+
check_info["hp_proliant"] = {
- 'check_function': check_proliant_general,
- 'inventory_function': inventory_proliant_general,
- 'service_description': 'General Status',
- 'snmp_info': ('.1.3.6.1.4.1.232', ['11.1.3.0',
'11.2.14.1.1.5.0', '2.2.2.1.0']),
- 'snmp_scan_function': \
- lambda oid: "8072.3.2.10" in oid(".1.3.6.1.2.1.1.2.0") or \
- (".1.3.6.1.4.1.311.1.1.3.1.2" in oid(".1.3.6.1.2.1.1.2.0") and
oid(".1.3.6.1.4.1.232.11.1.3.0")),
+ 'inventory_function' : inventory_proliant_general,
+ 'check_function' : check_proliant_general,
+ 'service_description' : 'General Status',
+ 'snmp_info' : ('.1.3.6.1.4.1.232', [
+ '11.1.3.0', #
CPQHOST-MIB::cpqHoMibCondition
+ '11.2.14.1.1.5.0', # cpqHoFwVerVersion
+ '2.2.2.1.0', #
CPQSINFO-MIB::cpqSiSysSerialNum
+ ]),
+ 'snmp_scan_function' : lambda oid: "8072.3.2.10" in
oid(".1.3.6.1.2.1.1.2.0") or \
+ (".1.3.6.1.4.1.311.1.1.3.1.2" in
oid(".1.3.6.1.2.1.1.2.0") and \
+ oid(".1.3.6.1.4.1.232.11.1.3.0")),
}