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_resources:sep(58)>>>
28 # pdb213rg:ONLINE:pasv0450:non-concurrent:OHN:FNPN:NFB:ignore::: : :::
29 # pdb213rg:OFFLINE:pasv0449:non-concurrent:OHN:FNPN:NFB:ignore::: : :::
30 # pmon01rg:ONLINE:pasv0449:non-concurrent:OHN:FNPN:NFB:ignore::: : :::
31 # pmon01rg:OFFLINE:pasv0450:non-concurrent:OHN:FNPN:NFB:ignore::: : :::
34 # {u'pdb213rg': [(u'pasv0450', u'online'), (u'pasv0449', u'offline')],
35 # u'pmon01rg': [(u'pasv0449', u'online'), (u'pasv0450', u'offline')]}
37 factory_settings
["aix_hacmp_resources"] = {
38 "expect_online_on": "first",
42 def parse_aix_hacmp_resources(info
):
45 joined_line
= " ".join(line
)
46 if 'There is no cluster definition' in joined_line
or 'Status of the RSCT subsystems' in joined_line
:
48 parsed
.setdefault(line
[0], []).append((line
[2], line
[1].lower()))
52 def inventory_aix_hacmp_resources(parsed
):
53 return [(key
, None) for key
in parsed
]
57 def check_aix_hacmp_resources(item
, params
, data
):
59 expected_behaviour
= "first"
61 expected_behaviour
= params
.get("expect_online_on", "first")
65 for node_name
, resource_state
in data
:
66 resource_states
.append(resource_state
)
67 infotext
+= "%s on node %s, " % (resource_state
, node_name
)
70 if expected_behaviour
== "first":
71 if resource_states
[0] != "online":
73 elif expected_behaviour
== "any":
74 if not any((resource_state
== u
"online" for resource_state
in resource_states
)):
77 return state
, infotext
[:-2]
80 check_info
['aix_hacmp_resources'] = {
81 'default_levels_variable': "aix_hacmp_resources",
82 'parse_function': parse_aix_hacmp_resources
,
83 'inventory_function': inventory_aix_hacmp_resources
,
84 'check_function': check_aix_hacmp_resources
,
85 'service_description': 'HACMP RG %s',
86 'group': 'hacmp_resources',