Module: check_mk
Branch: master
Commit: 578fcb5ecf5a4829c5344551fccf38304c9c1596
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=578fcb5ecf5a48…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Nov 13 16:09:13 2013 +0100
df: dynamic filesystem levels now reorder levels automatically
When defining several step for dynamic filesystem levels, e.g. one for
disk greater then 10GB, of for disks greater then 100GB and one for
filesystems greater then 0B (the rest), then you had to make sure that
the step for lagers disks would appear later. Otherwise they would be
ignored. This is now fixed and Check_MK automatically chooses the correct
step for a disk - regardless of the order.
---
.bugs/1083 | 10 ++++++++++
.werks/4 | 13 +++++++++++++
ChangeLog | 1 +
checks/df.include | 8 ++++++--
4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/.bugs/1083 b/.bugs/1083
new file mode 100644
index 0000000..8017ae1
--- /dev/null
+++ b/.bugs/1083
@@ -0,0 +1,10 @@
+Title: df: do not display negative levels
+Component: checks
+State: open
+Date: 2013-11-13 15:20:04
+Targetversion: future
+Class: nastiness
+
+The df check can now use negative levels. This means *free* spac.
+But in the check output this should be made clear and not just
+printed negative values.
diff --git a/.werks/4 b/.werks/4
new file mode 100644
index 0000000..cb72415
--- /dev/null
+++ b/.werks/4
@@ -0,0 +1,13 @@
+Title: df: dynamic filesystem levels now reorder levels automatically
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1384355214
+Class: feature
+
+When defining several step for dynamic filesystem levels, e.g. one for
+disk greater then 10GB, of for disks greater then 100GB and one for
+filesystems greater then 0B (the rest), then you had to make sure that
+the step for lagers disks would appear later. Otherwise they would be
+ignored. This is now fixed and Check_MK automatically chooses the correct
+step for a disk - regardless of the order.
diff --git a/ChangeLog b/ChangeLog
index 7d95ed1..6a16c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* 0068 check_sql: support for mssql databases included
* 0208 fileinfo.groups: Added minimum/maximum file size parameters...
* 0093 check_http: Default service description prefix can be avoided...
+ * 0004 df: dynamic filesystem levels now reorder levels automatically...
* 0024 FIX: cisco_wlc: removed configuration parameter ap_model
* 0065 FIX: veeam_client: check behaviour improved when backup is in progress
* 0066 FIX: veeam_jobs: check behaviour improved when backup is in progress
diff --git a/checks/df.include b/checks/df.include
index 477dbe6..7c4290c 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -142,11 +142,15 @@ def get_filesystem_levels(host, mountpoint, size_gb, params):
warn, crit = levels["levels"]
else:
# A list of levels. Choose the correct one depending on the
- # size of the current tablespace
+ # size of the current filesystem. We do not make the first
+ # rule match, but that with the largest size_gb. That way
+ # the order of the entries is not important.
found = False
+ found_size = 0
for to_size, this_levels in levels["levels"]:
- if size_gb * giga > to_size:
+ if size_gb * giga > to_size and to_size >= found_size:
warn, crit = this_levels
+ found_size = to_size
found = True
if not found:
warn, crit = 100.0, 100.0 # entry not found in list