Module: check_mk
Branch: master
Commit: 3ae0361c88ae40039683bedd40b2b315f1ec25a0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ae0361c88ae40…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Nov 23 09:37:32 2016 +0100
4089 oracle_tablespaces: file online states are now configurable if size info is
available
---
.werks/4089 | 9 +++++++++
ChangeLog | 1 +
checks/oracle_tablespaces | 24 +++++++++++++++++++++---
web/plugins/wato/check_parameters.py | 14 ++++++++++++++
4 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/.werks/4089 b/.werks/4089
new file mode 100644
index 0000000..9c9b43c
--- /dev/null
+++ b/.werks/4089
@@ -0,0 +1,9 @@
+Title: oracle_tablespaces: file online states are now configurable if size info is
available
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i3
+Date: 1479890179
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 4422ab5..eac296b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
* 3988 Windows agent: new global option disabled_sections...
* 3989 Logwatch patterns: now able to change state of context lines...
* 4087 netgear_fans, netgear_powersupplies, netgear_temp: new checks for Netgear
Switches which support the FASTPATH-BOXSERVICES-PRIVATE MIB
+ * 4089 oracle_tablespaces: file online states are now configurable if size info is
available
* 3987 FIX: Check_MK Agent Access: Windows agent reported incorrect only from value
* 3952 FIX: diskstat: fixed bug if multipath devices having an alias...
* 3939 FIX: f5_bigip_conns: readded performance data and graphs...
diff --git a/checks/oracle_tablespaces b/checks/oracle_tablespaces
index 89112f5..2985125 100644
--- a/checks/oracle_tablespaces
+++ b/checks/oracle_tablespaces
@@ -224,6 +224,7 @@ def check_oracle_tablespaces(item, params, parsed):
num_increments = 0
increment_size = 0
free_space = 0
+ file_online_states = {}
# Conversion of old autochecks params
if type(params) == tuple:
@@ -234,9 +235,22 @@ def check_oracle_tablespaces(item, params, parsed):
for datafile in tablespace["datafiles"]:
- if datafile["file_online_status"] in [ "OFFLINE",
"RECOVER" ]:
- yield 2, "One or more datafiles OFFLINE or RECOVER"
- return
+ df_file_online_status = datafile["file_online_status"]
+ if df_file_online_status in [ "OFFLINE", "RECOVER" ]:
+
+ file_online_states_params =
dict(params.get("map_file_online_states", []))
+ if datafile["block_size"] is not None and file_online_states_params
and \
+ df_file_online_status in file_online_states_params:
+
+ file_online_states.setdefault(df_file_online_status, {
+ "state" :
file_online_states_params[df_file_online_status],
+ "sids" : [],
+ })
+ file_online_states[df_file_online_status]["sids"].append(sid)
+
+ else:
+ yield 2, "One or more datafiles OFFLINE or RECOVER"
+ return
num_files += 1
if datafile["status"] in [ "AVAILABLE", "ONLINE",
"READONLY" ]:
@@ -347,6 +361,10 @@ def check_oracle_tablespaces(item, params, parsed):
yield 0, "%d data files (%d avail, %d autoext)" % \
(num_files, num_avail, num_extensible)
+ for file_online_state, attrs in file_online_states.items():
+ this_state = attrs["state"]
+ yield this_state, "Datafiles %s: %s" % (file_online_state, ",
".join(attrs["sids"]))
+
# If something changes adapt calculations in related inventory plugin
check_info['oracle_tablespaces'] = {
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 68b2b14..72f7a01 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -7602,6 +7602,20 @@ register_check_parameters(
]
)
),
+ ( "map_file_online_states",
+ ListOf(
+ Tuple(
+ orientation = "horizontal",
+ elements = [
+ DropdownChoice(choices = [
+ ("RECOVER", _("Recover")),
+ ("OFFLINE", _("Offline")),
+ ]),
+ MonitoringState()
+ ]),
+ title = _('Map file online states'),
+ )
+ ),
],
),
TextAscii(