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.
27 # In cooperation with Thorsten Bruhns from OPITZ Consulting
29 # <<<oracle_undostat>>>
30 # TUX2 160 0 1081 300 0
32 factory_settings
["oracle_undostat_defaults"] = {
34 "nospaceerrcnt_state": 2,
38 def inventory_oracle_undostat(info
):
39 return [(line
[0], {}) for line
in info
if len(line
) == 6]
42 def check_oracle_undostat(item
, params
, info
):
47 activeblks
, maxconcurrency
, tuned_undoretention
, maxquerylen
, nospaceerrcnt
= map(
49 warn
, crit
= params
["levels"]
51 if tuned_undoretention
== -1:
53 elif tuned_undoretention
<= crit
:
55 elif tuned_undoretention
<= warn
:
62 state_errcnt
= params
['nospaceerrcnt_state']
63 state
= max(state
, state_errcnt
)
65 nospaceerrcntpic
= "(!)"
66 elif state_errcnt
== 2:
67 nospaceerrcntpic
= "(!!)"
68 elif state_errcnt
== 3:
69 nospaceerrcntpic
= "(?)"
71 if tuned_undoretention
>= 0:
72 infotext
= "%s Undoretention (warn/crit at %s/%s), %d active undoblocks, " \
73 % (get_age_human_readable(tuned_undoretention
),
74 get_age_human_readable(warn
),
75 get_age_human_readable(crit
),
78 infotext
+= "%d max concurrent transactions, %s max querylen, %d space errors%s" \
80 get_age_human_readable(maxquerylen
),
81 nospaceerrcnt
, nospaceerrcntpic
)
84 ('activeblk', activeblks
),
85 ('transconcurrent', maxconcurrency
),
86 ('tunedretention', tuned_undoretention
, warn
, crit
),
87 ('querylen', maxquerylen
),
88 ('nonspaceerrcount', nospaceerrcnt
),
91 return state
, infotext
, perfdata
93 # In case of missing information we assume that the login into
94 # the database has failed and we simply skip this check. It won't
95 # switch to UNKNOWN, but will get stale.
96 raise MKCounterWrapped("Login into database failed")
99 check_info
['oracle_undostat'] = {
100 "check_function": check_oracle_undostat
,
101 "inventory_function": inventory_oracle_undostat
,
102 "service_description": "ORA %s Undo Retention",
103 "has_perfdata": True,
104 "default_levels_variable": "oracle_undostat_defaults",
105 "group": "oracle_undostat",