2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2017 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 factory_settings
['informix_tabextents_default_levels'] = {
33 def parse_informix_tabextents(info
):
38 if instance
is not None and line
== ["(constant)", "TABEXTENTS"]:
40 parsed
.setdefault(instance
, [])
41 parsed
[instance
].append(entry
)
43 elif line
[0].startswith("[[[") and line
[0].endswith("]]]"):
44 instance
= line
[0][3:-3]
46 elif entry
is not None:
47 entry
.setdefault(line
[0], line
[1])
52 def inventory_informix_tabextents(parsed
):
53 return [(instance
, {}) for instance
in parsed
]
56 def check_informix_tabextents(item
, params
, parsed
):
60 for entry
in parsed
[item
]:
61 extents
= int(entry
['extents'])
62 if extents
>= max_extents
:
64 long_output
.append("[%s/%s] Extents: %s, Rows: %s" % \
65 (entry
['db'], entry
["tab"], entry
['extents'], entry
['nrows']))
67 warn
, crit
= params
['levels']
69 infotext
= "Maximal extents: %s" % max_extents
70 if max_extents
>= crit
:
72 elif max_extents
>= warn
:
75 infotext
+= " (warn/crit at %s/%s)" % (warn
, crit
)
76 return state
, "%s\n%s" % (infotext
, "\n".join(long_output
)),\
77 [('max_extents', max_extents
)]
80 check_info
['informix_tabextents'] = {
81 'parse_function': parse_informix_tabextents
,
82 'inventory_function': inventory_informix_tabextents
,
83 'check_function': check_informix_tabextents
,
85 'service_description': 'Informix Table Extents %s',
86 'default_levels_variable': 'informix_tabextents_default_levels',