Module: check_mk
Branch: master
Commit: 7c84300b6756cb44c21cad8dcbe8502330ba6030
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7c84300b6756cb…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Apr 8 11:56:56 2014 +0200
oracle_tablespaces: improved formatting of levels text in check output
If you configure percentage levels within WATO the check will display them
as percentage in the check output, as well. Previously these values were always
displayed as bytes
---
.werks/829 | 10 ++++++++++
ChangeLog | 1 +
checks/oracle_tablespaces | 16 +++++++++++-----
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/.werks/829 b/.werks/829
new file mode 100644
index 0000000..d711ace
--- /dev/null
+++ b/.werks/829
@@ -0,0 +1,10 @@
+Title: oracle_tablespaces: improved formatting of levels text in check output
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1396950872
+Class: feature
+
+If you configure percentage levels within WATO the check will display them
+as percentage in the check output, as well. Previously these values were always
+displayed as bytes
diff --git a/ChangeLog b/ChangeLog
index 05ade8e..7deac55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
NOTE: Please refer to the migration notes!
* 0802 ibm_svc_nodestats.iops, ibm_svc_systemstats.iops: new checks for IO
operations/sec on IBM SVC / V7000 devices
* 0602 cmciii.humidity: new check for Rittals CMC III humidity sensors
+ * 0829 oracle_tablespaces: improved formatting of levels text in check output...
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
* 0786 FIX: zfsget: fixed compatibility with older Solaris agents...
* 0809 FIX: brocade_fcport: Fixed recently introduced problem with port speed
detection
diff --git a/checks/oracle_tablespaces b/checks/oracle_tablespaces
index ca850cf..05cb437 100644
--- a/checks/oracle_tablespaces
+++ b/checks/oracle_tablespaces
@@ -107,8 +107,9 @@ def get_tablespace_levels_in_bytes(size_bytes, params):
warn, crit = this_levels
break
else:
- return (None, None)
+ return None, None, ""
+ levels_text = "levels at "
if magic:
# convert warn/crit to percentage
if type(warn) != float:
@@ -131,19 +132,25 @@ def get_tablespace_levels_in_bytes(size_bytes, params):
crit_scaled = lowest_critical_level
warn_bytes = savefloat(size_bytes * warn_scaled / 100)
crit_bytes = savefloat(size_bytes * crit_scaled / 100)
+ levels_text += get_bytes_human_readable(warn_bytes)
+ levels_text += "/%s" % get_bytes_human_readable(crit_bytes)
else:
# warn/crit level are float => percentages of max size, otherwise MB
if type(warn) == float:
warn_bytes = warn / 100.0 * size_bytes
+ levels_text += "%.1f%%" % warn
else:
warn_bytes = warn * 1024 * 1024
+ levels_text += get_bytes_human_readable(warn_bytes)
if type(crit) == float:
crit_bytes = crit / 100.0 * size_bytes
+ levels_text += "/%.1f%%" % crit
else:
crit_bytes = crit * 1024 * 1024
+ levels_text += "/%s" % get_bytes_human_readable(crit_bytes)
- return warn_bytes, crit_bytes
+ return warn_bytes, crit_bytes, levels_text
def check_oracle_tablespaces(item, params, info):
@@ -242,15 +249,14 @@ def check_oracle_tablespaces(item, params, info):
infotext += ", no autoextend"
- warn, crit = get_tablespace_levels_in_bytes(max_size, params)
+ warn, crit, levels_text = get_tablespace_levels_in_bytes(max_size, params)
# Check free space, but only if status is not READONLY
if ts_status != "READONLY":
if (crit is not None and free_space <= crit) \
or (warn is not None and free_space <= warn):
infotext += ", only %s left" %
get_bytes_human_readable(free_space)
- infotext += " (levels at %s/%s)" % (
- get_bytes_human_readable(warn), get_bytes_human_readable(crit))
+ infotext += " (%s)" % levels_text
if free_space <= crit:
status = 2
else: