[checkmk-commits] Check_MK Git: check_mk: FIX: if Checks now fallback to byte as UOM if none was specified in parameters

git version control git at mathias-kettner.de
Tue Nov 20 17:58:14 CET 2012


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

Author: Florian Heigl <fh at mathias-kettner.de>
Date:   Tue Nov 20 17:58:04 2012 +0100

FIX: if Checks now fallback to byte as UOM if none was specified in parameters

---

 checks/if.include |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/checks/if.include b/checks/if.include
index b61c6dd..3fc3de4 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -140,7 +140,7 @@ def check_if_common(item, params, info):
     targetspeed        = params.get("speed")
     targetstate        = params.get("state")
     average            = params.get("average")
-    unit               = params.get("unit")
+    unit               = params.get("unit", "B")
     unit_multiplier    = unit == "Bit" and 8.0 or 1.0
 
     # error checking might be turned off
@@ -241,9 +241,9 @@ def check_if_common(item, params, info):
             # Even if the measurement unit is set to "bit" the WARN and CRIT levels are 
             # still reported as bytes to stay compatible with older rrd data
             if unit == "Bit":
-                if bw_crit:
+                if bw_crit and bw_crit != None:
                     bw_crit = bw_crit / 8
-                if bw_warn:
+                if bw_warn and bw_warn != None:
                     bw_warn = bw_warn / 8
 
             # Performance counters



More information about the checkmk-commits mailing list