2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 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.
28 # TUX12C|273|2985|ora12c.local|sqlplus@ora12c.local (TNS V1-V3)|46148|oracle|633|NULL|NULL
29 # newdb|25|15231|ol6131|sqlplus@ol6131 (TNS V1-V3)|13275|oracle|SYS|3782|VALID|1|407|1463|ol6131|sqlplus@ol6131 (TNS V1-V3)|13018|oracle|SYS
31 factory_settings
["oracle_locks_defaults"] = {
32 "levels": (1800, 3600),
36 def inventory_oracle_locks(info
):
37 return [(line
[0], {}) for line
in info
if len(line
) >= 10]
40 def check_oracle_locks(item
, params
, info
):
46 warn
, crit
= params
["levels"]
47 if line
[0] == item
and line
[1] != '':
48 err
= oracle_handle_ora_errors(line
)
51 elif isinstance(err
, tuple):
56 # old format from locks_old in current plugin
57 _sid
, sidnr
, serial
, machine
, _program
, process
, osuser
, ctime
, \
58 object_owner
, object_name
= line
62 _sid
, sidnr
, serial
, machine
, _program
, process
, osuser
, _dbusername
, ctime
, \
63 _block_status
, _blk_inst_id
, _blk_sid
, _blk_serial
, _blk_machine
, _blk_program
, \
64 _blk_process
, _blk_osuser
, _blk_dbusername
= line
71 raise MKCounterWrapped("Unknow number of items in agent output")
78 infotext
+= 'locktime %s (!!) Session (sid,serial, proc) %s,%s,%s machine %s osuser %s object: %s.%s ; ' \
79 % (get_age_human_readable(ctime
), sidnr
, serial
, process
, machine
, osuser
, object_owner
, object_name
)
84 infotext
+= 'locktime %s (!) Session (sid,serial, proc) %s,%s,%s machine %s osuser %s object: %s.%s ; ' \
85 % (get_age_human_readable(ctime
), sidnr
, serial
, process
, machine
, osuser
, object_owner
, object_name
)
87 if line
[0] == item
and line
[1] == '':
91 infotext
= 'No locks existing'
93 infotext
= 'more then 10 locks existing!'
96 return (state
, infotext
)
98 # In case of missing information we assume that the login into
99 # the database has failed and we simply skip this check. It won't
100 # switch to UNKNOWN, but will get stale.
101 raise MKCounterWrapped("Login into database failed")
104 check_info
["oracle_locks"] = {
105 'check_function': check_oracle_locks
,
106 'inventory_function': inventory_oracle_locks
,
107 'service_description': 'ORA %s Locks',
108 "default_levels_variable": "oracle_locks_defaults",
109 'group': 'oracle_locks',
110 'includes': ['oracle.include'],