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 if line
[0] not in parsed
:
46 parsed
[line
[0]] = [(line
[2], line
[1].lower())]
48 parsed
[line
[0]].append((line
[2], line
[1].lower()))
53 def inventory_aix_hacmp_resources(parsed
):
54 return [(key
, None) for key
in parsed
]
58 def check_aix_hacmp_resources(item
, params
, data
):
60 expected_behaviour
= "first"
62 expected_behaviour
= params
.get("expect_online_on", "first")
66 for node_name
, resource_state
in data
:
67 resource_states
.append(resource_state
)
68 infotext
+= "%s on node %s, " % (resource_state
, node_name
)
71 if expected_behaviour
== "first":
72 if resource_states
[0] != "online":
74 elif expected_behaviour
== "any":
75 if not any((resource_state
== u
"online" for resource_state
in resource_states
)):
78 return state
, infotext
[:-2]
81 check_info
['aix_hacmp_resources'] = {
82 'default_levels_variable': "aix_hacmp_resources",
83 'parse_function': parse_aix_hacmp_resources
,
84 'inventory_function': inventory_aix_hacmp_resources
,
85 'check_function': check_aix_hacmp_resources
,
86 'service_description': 'HACMP RG %s',
87 'group': 'hacmp_resources',