2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2015 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.
27 # <<<aix_hacmp_nodes>>>
32 # Interfaces to network prod_net
33 # Communication Interface: Name pasv0449, Attribute public, IP address 172.22.237.14
34 # Communication Interface: Name pasc0159, Attribute public, IP address 172.22.237.17
35 # Communication Interface: Name pasc0158, Attribute public, IP address 172.22.237.16
38 # Interfaces to network TEST_net
39 # Communication Interface: Name pasv0449, Attribute public, IP address 172.22.237.14
40 # Communication Interface: Name pasc0159, Attribute public, IP address 172.22.237.17
41 # Communication Interface: Name pasc0158, Attribute public, IP address 172.22.237.16
44 # Interfaces to network prod_net
45 # Communication Interface: Name pasv0450, Attribute public, IP address 172.22.237.15
46 # Communication Interface: Name pasc0159, Attribute public, IP address 172.22.237.17
47 # Communication Interface: Name pasc0158, Attribute public, IP address 172.22.237.16
50 # {u'pasv0449': {u'prod_net': [(u'pasv0449', u'public', u'172.22.237.14'),
51 # (u'pasc0159', u'public', u'172.22.237.17'),
52 # (u'pasc0158', u'public', u'172.22.237.16')]},
53 # u'pasv0450': {u'prod_net': [(u'pasv0450', u'public', u'172.22.237.15'),
54 # (u'pasc0159', u'public', u'172.22.237.17'),
55 # (u'pasc0158', u'public', u'172.22.237.16')]}
59 def parse_aix_hacmp_nodes(info
):
66 elif 'NODE' in line
[0]:
67 if line
[1].replace(':', '') in parsed
:
68 node_name
= line
[1].replace(':', '')
73 elif 'Interfaces' in line
[0] and get_details
:
74 network_name
= line
[3].replace(',', '')
75 parsed
[node_name
][network_name
] = []
77 elif 'Communication' in line
[0] and get_details
:
78 parsed
[node_name
][network_name
].append((line
[3].replace(',', ''), line
[5].replace(
79 ',', ''), line
[8].replace(',', '')))
84 def inventory_aix_hacmp_nodes(parsed
):
85 return [(key
, None) for key
in parsed
]
88 def check_aix_hacmp_nodes(item
, _no_params
, parsed
):
90 for network_name
in parsed
[item
]:
91 infotext
= "Network: %s" % network_name
93 for if_name
, attribute
, ip_adr
in parsed
[item
][network_name
]:
94 infotext
+= ", interface: %s, attribute: %s, IP: %s" % (if_name
, attribute
, ip_adr
)
99 check_info
['aix_hacmp_nodes'] = {
100 'parse_function': parse_aix_hacmp_nodes
,
101 'inventory_function': inventory_aix_hacmp_nodes
,
102 'check_function': check_aix_hacmp_nodes
,
103 'service_description': 'HACMP Node %s',