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 # <<<oracle_recovery_area>>>
31 # ORACLE_SID used_pct size used reclaimable
33 factory_settings
["oracle_recovery_area_defaults"] = {
34 "levels": (70.0, 90.0),
38 def inventory_oracle_recovery_area(info
):
39 return [(line
[0], {}) for line
in info
]
42 def check_oracle_recovery_area(item
, params
, info
):
45 size_mb
, used_mb
, reclaimable_mb
= map(int, line
[2:5])
49 perc_used
= float(used_mb
- reclaimable_mb
) / size_mb
* 100
51 warn
, crit
= params
["levels"]
52 warn_mb
= size_mb
* warn
/ 100
53 crit_mb
= size_mb
* crit
/ 100
57 elif perc_used
>= warn
:
63 return state
, "%s out of %s used (%.1f%%, warn/crit at %s%%/%s%%), %s reclaimable" \
64 % (get_bytes_human_readable(used_mb
*mb
), get_bytes_human_readable(size_mb
*mb
), \
65 perc_used
, warn
, crit
, get_bytes_human_readable(reclaimable_mb
*mb
)), \
66 [('used', used_mb
, warn_mb
, crit_mb
, 0, size_mb
), ('reclaimable', reclaimable_mb
)]
68 # In case of missing information we assume that the login into
69 # the database has failed and we simply skip this check. It won't
70 # switch to UNKNOWN, but will get stale.
71 raise MKCounterWrapped("Login into database failed")
74 check_info
['oracle_recovery_area'] = {
75 "check_function": check_oracle_recovery_area
,
76 "inventory_function": inventory_oracle_recovery_area
,
77 "service_description": "ORA %s Recovery Area",
79 "default_levels_variable": "oracle_recovery_area_defaults",
80 "group": "oracle_recovery_area",