Module: check_mk
Branch: master
Commit: 8fc47589b3ccb0eee4d450222b580f2125ae2004
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fc47589b3ccb0…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jun 26 14:21:20 2014 +0200
FIX oracle_tablespaces: fixed calculation of space left and number of remaining
increments
The remaining increments and space left was not correctly calculated when the
remaining memory space was not a multiple of the increment size.<br>
For example:<br>
C+:
Tablespace
900 MB used
100 MB free space for autoincrement
200 MB increment size
C-:
The previous version calculated 900 MB as maximum size, because the increment size was
greater
than the remaining autoincrement space. This was wrong. The last increment also uses the
remaining
space, even if the remaining size is smaller than the increment size.<br><br>
As a result, this fix actually increases the amount of available free space,
so it should not have any negative side effects for already configured limits.
---
.werks/944 | 26 ++++++++++++++++++++++++++
ChangeLog | 1 +
checks/oracle_tablespaces | 11 ++++++++---
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/.werks/944 b/.werks/944
new file mode 100644
index 0000000..981ada8
--- /dev/null
+++ b/.werks/944
@@ -0,0 +1,26 @@
+Title: oracle_tablespaces: fixed calculation of space left and number of remaining
increments
+Level: 2
+Component: checks
+Version: 1.2.5i5
+Date: 1403784236
+Class: fix
+
+The remaining increments and space left was not correctly calculated when the
+remaining memory space was not a multiple of the increment size.<br>
+For example:<br>
+
+C+:
+Tablespace
+900 MB used
+100 MB free space for autoincrement
+
+200 MB increment size
+C-:
+
+The previous version calculated 900 MB as maximum size, because the increment size was
greater
+than the remaining autoincrement space. This was wrong. The last increment also uses the
remaining
+space, even if the remaining size is smaller than the increment
size.<br><br>
+
+As a result, this fix actually increases the amount of available free space,
+so it should not have any negative side effects for already configured limits.
+
diff --git a/ChangeLog b/ChangeLog
index 52ba5bc..488d804 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
+ * 0944 FIX: oracle_tablespaces: fixed calculation of space left and number of
remaining increments...
WATO:
* 0990 FIX: Fix HTTP error handling in bulk inventory...
diff --git a/checks/oracle_tablespaces b/checks/oracle_tablespaces
index 05cb437..f4971b0 100644
--- a/checks/oracle_tablespaces
+++ b/checks/oracle_tablespaces
@@ -202,10 +202,15 @@ def check_oracle_tablespaces(item, params, info):
incsize = int(line[8]) # size of next increment in blocks
if incsize == 1:
uses_default_increment = True
- incs = free_bl / incsize
+
+ incs, rest = divmod(free_bl, incsize)
+ if rest:
+ incs += 1
+
num_increments += incs
- increment_size += blocksize * incsize * incs
- free_space += blocksize * (incsize * incs + (int(line[12])))
+ increment_size += blocksize * incsize * incs - rest * blocksize
+ free_space += blocksize * (incsize * incs + (int(line[12]))) -
rest * blocksize
+
# not autoextensible: take current size as maximum
else:
my_max_size = blocksize * int(line[5])