Module: check_mk
Branch: master
Commit: 7d9771d9add9324b4309ab3631584b552dacafef
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7d9771d9add932…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri May 6 16:27:43 2011 +0200
df: fix problems with check parameters
The check crashed, if old style (tuple) parameters where used.
---
checks/df.include | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/checks/df.include b/checks/df.include
index 6f8d3dd..930ce0b 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -59,13 +59,20 @@ factory_settings["filesystem_default_levels"] = {
# compute warning and critical levels. Takes into account the size of
# the filesystem and the magic number. Since the size is only known at
# check time this function's result cannot be precompiled.
+# Note: this function is in our days only needed in order to support
+# old style params a'la (80, 90). As soon as we drop support for that
+# (can happen any decade now), we can get rid of this function.
def get_filesystem_levels(host, mountpoint, size_gb, params):
- # convert default levels to dictionary
+ # Start with factory settings
+ levels = factory_settings["filesystem_default_levels"].copy()
+ # convert default levels to dictionary. This is in order support
+ # old style levels like (80, 90)
if type(filesystem_default_levels) == dict:
- levels = filesystem_default_levels.copy()
+ levels.update(filesystem_default_levels)
else:
- levels = { "levels": filesystem_default_levels[:2] }
+ levels = factory_settings["filesystem_default_levels"].copy()
+ levels["levels"] = filesystem_default_levels[:2]
if len(filesystem_default_levels) == 2:
levels["magic"] = None
else: