Cleanup config.nodes_of
[check_mk.git] / checks / aix_hacmp_services
blobcce977af6b16d50b38886824e8fb5d76ca3c1ca7
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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 # hacmp-aix
28 # <<<aix_hacmp_services>>>
29 # Status of the RSCT subsystems used by PowerHA SystemMirror:
30 # Subsystem Group PID Status
31 # cthags cthags 8257694 active
32 # ctrmc rsct 7995636 active
34 # Status of the PowerHA SystemMirror subsystems:
35 # Subsystem Group PID Status
36 # clstrmgrES cluster 9109590 active
37 # clevmgrdES cluster 29098102 active
39 # Status of the CAA subsystems:
40 # Subsystem Group PID Status
41 # clcomd caa 6619358 active
42 # clconfd caa 10944716 active
44 # Details of PowerHA SystemMirror cluster manager:
45 # Current state: ST_STABLE
46 # sccsid = "@(#)36 1.135.1.118 src/43haes/usr/sbin/cluster/hacmprd/main.C,hacmp.pe,61haes_r713,1343A_hacmp713 10/21/"
47 # build = "Oct 27 2014 16:03:01 1433C_hacmp713"
48 # i_local_nodeid 1, i_local_siteid -1, my_handle 1
49 # ml_idx[1]=1 ml_idx[2]=0
50 # There are 0 events on the Ibcast queue
51 # There are 0 events on the RM Ibcast queue
52 # CLversion: 15
53 # local node vrmf is 7132
54 # cluster fix level is "2"
55 # The following timer(s) are currently active:
56 # Current DNP values
57 # DNP Values for NodeId - 2 NodeName - pasv0449
58 # PgSpFree = 6280459 PvPctBusy = 0 PctTotalTimeIdle = 40.060893
59 # DNP Values for NodeId - 1 NodeName - pasv0450
60 # PgSpFree = 6276175 PvPctBusy = 0 PctTotalTimeIdle = 80.135962
61 # CAA Cluster Capabilities
62 # CAA Cluster services are active
63 # There are 4 capabilities
64 # Capability 0
65 # id: 3 version: 1 flag: 1
66 # Hostname Change capability is defined and globally available
67 # Capability 1
68 # id: 2 version: 1 flag: 1
69 # Unicast capability is defined and globally available
70 # Capability 2
71 # id: 0 version: 1 flag: 1
72 # IPV6 capability is defined and globally available
73 # Capability 3
74 # id: 1 version: 1 flag: 1
75 # Site capability is defined and globally available
76 # trcOn 0, kTraceOn 0, stopTraceOnExit 0, cdNodeOn 0
77 # Last event run was DA_RES_CO on node 2
79 # parsed = {
80 # u'CAA': [(u'clcomd', u'caa', u'6619358', u'active'),
81 # (u'clconfd', u'caa', u'10944716', u'active')],
82 # u'PowerHA SystemMirror': [(u'clstrmgrES', u'cluster', u'9109590', u'active'),
83 # (u'clevmgrdES', u'cluster', u'29098102', u'active')],
84 # u'RSCT': [(u'cthags', u'cthags', u'8257694', u'active'),
85 # (u'ctrmc', u'rsct', u'7995636', u'active')],
86 # }
89 def parse_aix_hacmp_services(info):
90 parsed = {}
91 inst = None
92 for line in info:
93 if line[0] == 'Details':
94 inst = None
96 elif line[0] == 'Status':
97 subsystem_ty_name = line[3]
98 if subsystem_ty_name == 'PowerHA':
99 subsystem_ty_name += " %s" % line[4]
100 inst = parsed.setdefault(subsystem_ty_name, [])
102 elif line[0] == 'Subsystem':
103 # header line
104 continue
106 elif inst is not None and len(line) in [3, 4]:
107 # Not all lines contain PID:
108 # clcomd caa 7537142 active
109 # clconfd caa inoperative
110 inst.append((line[0], line[-1]))
112 return parsed
115 def inventory_aix_hacmp_services(parsed):
116 return [(key, None) for key in parsed]
119 def check_aix_hacmp_services(item, _no_params, parsed):
120 if item in parsed:
121 for subsytem_name, status in parsed[item]:
123 if status == 'active':
124 state = 0
125 else:
126 state = 2
128 infotext = "subsytem: %s, status: %s" \
129 % (subsytem_name, status)
131 yield state, infotext
134 check_info['aix_hacmp_services'] = {
135 'parse_function': parse_aix_hacmp_services,
136 'inventory_function': inventory_aix_hacmp_services,
137 'check_function': check_aix_hacmp_services,
138 'service_description': 'HACMP Service %s',