2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2018 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 _try_set(node
, nkey
, parsed
, pkey
):
30 node
[nkey
] = parsed
[pkey
]
36 def parse_aix_lparstat_inventory(info
):
37 lines
= (raw
[0] for raw
in info
if ':' in raw
[0])
38 pairs
= (line
.split(':', 1) for line
in lines
)
39 parsed
= {k
.strip(): v
.strip() for k
, v
in pairs
}
43 def inv_aix_lparstat_inventory(info
, inventory_tree
):
44 parsed
= parse_aix_lparstat_inventory(info
)
46 cpu_node
= inventory_tree
.get_dict('hardware.cpu.')
47 sys_node
= inventory_tree
.get_dict('hardware.system.')
49 _try_set(cpu_node
, "cpu_max_capa", parsed
, "Maximum Capacity")
50 _try_set(cpu_node
, "type", parsed
, "Type")
52 _try_set(sys_node
, "node_name", parsed
, "Node Name")
53 _try_set(sys_node
, "partition_name", parsed
, "Partition Name")
54 _try_set(sys_node
, "partition_number", parsed
, "Partition Number")
57 inv_info
['aix_lparstat_inventory'] = {
58 "inv_function": inv_aix_lparstat_inventory
,