2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2016 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 def inv_hp_proliant_mem(info
):
32 "3": 'cpqSingleWidthModule',
33 "4": 'cpqDoubleWidthModule',
36 "7": 'compaq-specific',
38 "9": 'smallOutlineDimm',
50 node
= inv_tree_list("hardware.memory.arrays:")
53 for _board_index
, module_index
, module_size_str
, module_type
, \
54 _module_status
, _module_condition
, module_serial
, cpu_num
in info
:
56 (int(cpu_num
) - 1, module_index
), {
57 "serial": module_serial
,
58 "type": map_mem_types
.get(module_type
, "unknown(%s)" % module_type
),
61 # From dmidecode in case of dual host config we have to proof
62 # if there's already an existing devices table
64 for (cpu_num
, module_index
), module_info
in infos
.items():
65 for entry
in node
[cpu_num
].get("devices", []):
66 if entry
["set"] == module_index
:
67 entry
.update(module_info
)
69 array
= {"devices": []}
70 for _board_index
, module_index
, module_size_str
, module_type
, \
71 _module_status
, _module_condition
, module_serial
, cpu_num
in info
:
73 array
["devices"].append({
74 "size": float(module_size_str
) * 1024,
75 "serial": module_serial
,
76 "type": map_mem_types
.get(module_type
, "unknown(%s)" % module_type
),
84 inv_info
['hp_proliant_mem'] = {
85 'inv_function': inv_hp_proliant_mem
,
86 # If something changes here please adopt the related check
88 ".1.3.6.1.4.1.232.6.2.14.13.1",
90 "2", # CPQHLTH-MIB::cpqHeResMem2BoardNum
91 "1", # CPQHLTH-MIB::cpqHeResMem2Module
92 "6", # CPQHLTH-MIB::cpqHeResMem2ModuleSize
93 "7", # CPQHLTH-MIB::cpqHeResMem2ModuleType
94 "19", # CPQHLTH-MIB::cpqHeResMem2ModuleStatus
95 "20", # CPQHLTH-MIB::cpqHeResMem2ModuleCondition
96 "12", # CPQHLTH-MIB::cpqHeResMem2SerialNo
97 "3", # CPQHLTH-MIB::cpqHeResMem2CpuNum
99 'snmp_scan_function': lambda oid
: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),