Skip to content

Commit

Permalink
7782 FIX hp_proliant_da_phydrv, hp_proliant_mem: Fixed crashes caused…
Browse files Browse the repository at this point in the history
… 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
si-23 committed Jun 12, 2019
1 parent 6e7438c commit 6a6321f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 35 deletions.
14 changes: 14 additions & 0 deletions .werks/7782
@@ -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.
5 changes: 4 additions & 1 deletion checks/hp_proliant.include
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion checks/hp_proliant_da_phydrv
Expand Up @@ -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)]

Expand Down Expand Up @@ -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(),
}
2 changes: 2 additions & 0 deletions checks/hp_proliant_mem
Expand Up @@ -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'],
Expand Down
19 changes: 0 additions & 19 deletions inventory/hp_proliant_da_phydrv
Expand Up @@ -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(),
}
14 changes: 0 additions & 14 deletions inventory/hp_proliant_mem
Expand Up @@ -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.