Skip to content
Permalink
Browse files

7782 FIX hp_proliant_da_phydrv, hp_proliant_mem: Fixed crashes caused…

… by different but partial similar SNMP info

Both plugins have a check and a related inventory plugin.
The check plugin processes a subset of the inventory plugin.
During some refactorings the fetched OIDs were adapted.
This caused crashes during checking and inventory phase.

Change-Id: Ibeee6e44d11ada8f206aab031c2e40d93c495585
  • Loading branch information...
Simon Jess
Simon Jess committed Jun 11, 2019
1 parent 6e7438c commit 6a6321fa3624b83e1932153b2c7988b400838057
Showing with 25 additions and 35 deletions.
  1. +14 −0 .werks/7782
  2. +4 −1 checks/hp_proliant.include
  3. +5 −1 checks/hp_proliant_da_phydrv
  4. +2 −0 checks/hp_proliant_mem
  5. +0 −19 inventory/hp_proliant_da_phydrv
  6. +0 −14 inventory/hp_proliant_mem
@@ -0,0 +1,14 @@
Title: hp_proliant_da_phydrv, hp_proliant_mem: Fixed crashes caused by different but partial similar SNMP info
Level: 1
Component: checks
Compatible: compat
Edition: cre
Version: 1.7.0i1
Date: 1560260000
Class: fix

Both plugins have a check and a related inventory plugin.
The check plugin processes a subset of the SNMP data of the
inventory plugin.
During some refactorings the fetched OIDs were adapted.
This caused crashes during checking and inventory phase.
@@ -312,8 +312,11 @@ def inventory_hp_proliant_mem(info):
def check_hp_proliant_mem(item, params, info):
for line in info:
if line[1] == item:
# Note: mgmt_hp_proliant_mem provides exact 6 values;
# hp_proliant provides 10 values because related inventory plugin
# needs the last 4.
board_index, module_index, module_size, module_type, \
module_status, module_condition = line
module_status, module_condition = line[:6]

module_size_mb = int(module_size) / 1024

@@ -66,7 +66,7 @@ def check_hp_proliant_da_phydrv(item, _no_params, info):
# First condition is for legacy discovered services
if line[1] == item or (line[0] + '/' + line[1]) == item:
_cntlr_index, _index, bay, status, ref_hours, size, condition, \
bus_number, smart_status = line
bus_number, smart_status, _model, _serial, _ty, _fw = line

snmp_status = hp_proliant_da_phydrv_status[int(status)]

@@ -98,6 +98,10 @@ check_info["hp_proliant_da_phydrv"] = {
"37", # CPQIDA-MIB::cpqDaPhyDrvCondition
"50", # CPQIDA-MIB::cpqDaPhyDrvBusNumber
"57", # CPQIDA-MIB::cpqDaPhyDrvSmartStatus
"3", # CPQIDA-MIB::cpqDaPhyDrvModel
"51", # CPQIDA-MIB::cpqDaPhyDrvSerialNum
"60", # CPQIDA-MIB::pqDaPhyDrvType
"4", # CPQIDA-MIB::cpqDaPhyDrvFWRev
]),
'snmp_scan_function': lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),
}
@@ -38,6 +38,8 @@ check_info["hp_proliant_mem"] = {
"7", # CPQHLTH-MIB::cpqHeResMem2ModuleType
"19", # CPQHLTH-MIB::cpqHeResMem2ModuleStatus
"20", # CPQHLTH-MIB::cpqHeResMem2ModuleCondition
"12", # CPQHLTH-MIB::cpqHeResMem2SerialNo
"3", # CPQHLTH-MIB::cpqHeResMem2CpuNum
]),
'snmp_scan_function': lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),
'includes': ['hp_proliant.include'],
@@ -51,23 +51,4 @@ def inv_hp_proliant_da_phydrv(info):

inv_info['hp_proliant_da_phydrv'] = {
'inv_function': inv_hp_proliant_da_phydrv,
# If something changes here please adopt the related check
'snmp_info': (
".1.3.6.1.4.1.232.3.2.5.1.1",
[
"1", # CPQIDA-MIB::cpqDaPhyDrvCntlrIndex
"2", # CPQIDA-MIB::cpqDaPhyDrvIndex
"5", # CPQIDA-MIB::cpqDaPhyDrvBay
"6", # CPQIDA-MIB::cpqDaPhyDrvStatus
"9", # CPQIDA-MIB::cpqDaPhyDrvRefHours
"45", # CPQIDA-MIB::cpqDaPhyDrvSize
"37", # CPQIDA-MIB::cpqDaPhyDrvCondition
"50", # CPQIDA-MIB::cpqDaPhyDrvBusNumber
"57", # CPQIDA-MIB::cpqDaPhyDrvSmartStatus
"3", # CPQIDA-MIB::cpqDaPhyDrvModel
"51", # CPQIDA-MIB::cpqDaPhyDrvSerialNum
"60", # CPQIDA-MIB::pqDaPhyDrvType
"4", # CPQIDA-MIB::cpqDaPhyDrvFWRev
]),
'snmp_scan_function': lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),
}
@@ -83,18 +83,4 @@ def inv_hp_proliant_mem(info):

inv_info['hp_proliant_mem'] = {
'inv_function': inv_hp_proliant_mem,
# If something changes here please adopt the related check
'snmp_info': (
".1.3.6.1.4.1.232.6.2.14.13.1",
[
"2", # CPQHLTH-MIB::cpqHeResMem2BoardNum
"1", # CPQHLTH-MIB::cpqHeResMem2Module
"6", # CPQHLTH-MIB::cpqHeResMem2ModuleSize
"7", # CPQHLTH-MIB::cpqHeResMem2ModuleType
"19", # CPQHLTH-MIB::cpqHeResMem2ModuleStatus
"20", # CPQHLTH-MIB::cpqHeResMem2ModuleCondition
"12", # CPQHLTH-MIB::cpqHeResMem2SerialNo
"3", # CPQHLTH-MIB::cpqHeResMem2CpuNum
]),
'snmp_scan_function': lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),
}

0 comments on commit 6a6321f

Please sign in to comment.
You can’t perform that action at this time.