Licenses: Updated the list of licenses and added a PDF containing all license texts
[check_mk.git] / inventory / hp_proliant_mem
blob799a87982e0a0995fadea0bdfc11fcfa8bc0914e
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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):
29 map_mem_types = {
30 "1": 'other',
31 "2": 'board',
32 "3": 'cpqSingleWidthModule',
33 "4": 'cpqDoubleWidthModule',
34 "5": 'simm',
35 "6": 'pcmcia',
36 "7": 'compaq-specific',
37 "8": 'DIMM',
38 "9": 'smallOutlineDimm',
39 "10": 'RIMM',
40 "11": 'SRIMM',
41 "12": 'FB-DIMM',
42 "13": 'DIMM DDR',
43 "14": 'DIMM DDR2',
44 "15": 'DIMM DDR3',
45 "16": 'DIMM FBD2',
46 "17": 'FB-DIMM DDR2',
47 "18": 'FB-DIMM DDR3',
50 node = inv_tree_list("hardware.memory.arrays:")
52 infos = {}
53 for _board_index, module_index, module_size_str, module_type, \
54 _module_status, _module_condition, module_serial, cpu_num in info:
55 infos.setdefault(
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
63 try:
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)
68 except:
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),
77 "set": module_index,
78 "locator": cpu_num
81 node.append(array)
84 inv_info['hp_proliant_mem'] = {
85 'inv_function': inv_hp_proliant_mem,
86 # If something changes here please adopt the related check
87 'snmp_info': (
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
98 ]),
99 'snmp_scan_function': lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),