[checkmk-commits] Check_MK Git: check_mk: df.include: fixed exception when used_perc was 0

Andreas Boesl ab at mathias-kettner.de
Tue Feb 10 15:47:53 CET 2015


Module: check_mk
Branch: master
Commit: e15e680764a43e155555df2ecba135a91b45dac3
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e15e680764a43e155555df2ecba135a91b45dac3

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Tue Feb 10 15:47:08 2015 +0100

df.include: fixed exception when used_perc was 0

---

 checks/df.include |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/checks/df.include b/checks/df.include
index 1254572..fa8f36d 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -319,7 +319,10 @@ def df_check_filesystem_single(hostname, mountpoint, size_mb, avail_mb, reserved
 
     # Show enough decimal digits so that very small percentages are still
     # visible!
-    perc_precision = max(1, 2 - int(round(math.log(used_perc, 10))))
+    if used_perc > 0:
+        perc_precision = max(1, 2 - int(round(math.log(used_perc, 10))))
+    else:
+        perc_precision = 1
     infotext = "%%.%df%%%% used (%%s of %%s), %%s" % perc_precision % (used_perc, used_hr, size_hr, levels["levels_text"])
 
     status = 0



More information about the checkmk-commits mailing list