2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2019 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 tmpl 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 tmpl for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # tmpl 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 parse_sap_hana_proc(info
):
30 for (sid_instance
, node
), lines
in parse_sap_hana(info
).iteritems():
35 inst
= parsed
.setdefault(
36 ("%s %s" % (sid_instance
, line
[1]), node
), {
44 inst
["sql_port"] = int(line
[5])
46 inst
["sql_port"] = None
50 def inventory_sap_hana_proc(parsed
):
51 for (sid_instance
, _node
), data
in parsed
.iteritems():
52 yield sid_instance
, {'coordin': data
['coordin']}
55 def check_sap_hana_proc(item
, params
, parsed
):
56 for (sid_instance
, node
), data
in parsed
.iteritems():
57 if item
!= sid_instance
:
61 yield 0, 'On node: %s' % node
63 yield 0, 'Port: %s, PID: %s' % (data
['port'], data
['pid'])
65 p_coordin
= params
['coordin']
66 coordin
= data
['coordin']
67 if p_coordin
!= coordin
:
68 yield 1, "Role: changed from %s to %s" % (p_coordin
, coordin
)
69 elif coordin
.lower() != 'none':
70 yield 0, "Role: %s" % coordin
72 sql_port
= data
['sql_port']
74 yield 0, "SQL-Port: %s" % sql_port
75 if data
['acting'].lower() != 'yes':
79 check_info
['sap_hana_proc'] = {
80 'parse_function': parse_sap_hana_proc
,
81 'inventory_function': inventory_sap_hana_proc
,
82 'check_function': check_sap_hana_proc
,
83 'service_description': 'SAP HANA Process %s',
84 'includes': ['sap_hana.include'],