[checkmk-commits] Check_MK Git: check_mk: Minor optical fix in output of predictive monitory

Mathias Kettner mk at mathias-kettner.de
Thu Aug 21 10:20:06 CEST 2014


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

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Thu Aug 21 10:17:14 2014 +0200

Minor optical fix in output of predictive monitory

---

 modules/check_mk_base.py |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 68a1385..7d2277e 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1603,7 +1603,7 @@ def check_levels(value, dsname, params, unit="", factor=1.0, scale=1.0, statemar
         unit = " " + unit # Insert space before MB, GB, etc.
 
     perfdata = []
-    infotext = ""
+    infotexts = []
 
     # None or (None, None) -> do not check any levels
     if params == None or params == (None, None):
@@ -1621,9 +1621,9 @@ def check_levels(value, dsname, params, unit="", factor=1.0, scale=1.0, statemar
             ref_value, ((warn_upper, crit_upper), (warn_lower, crit_lower)) = \
                 get_predictive_levels(dsname, params, "MAX", levels_factor=factor * scale)
             if ref_value:
-                infotext += "predicted reference: %.2f%s" % (ref_value * factor / scale, unit)
+                infotexts.append("predicted reference: %.2f%s" % (ref_value * factor / scale, unit))
             else:
-                infotext += "no reference for prediction yet"
+                infotexts.append("no reference for prediction yet")
         except Exception, e:
             if opt_debug:
                 raise
@@ -1635,23 +1635,28 @@ def check_levels(value, dsname, params, unit="", factor=1.0, scale=1.0, statemar
     # Critical cases
     if crit_upper != None and value >= crit_upper:
         state = 2
-        infotext += " (critical level at %.2f%s)" % (crit_upper / factor / scale, unit)
+        infotexts.append("critical level at %.2f%s" % (crit_upper / factor / scale, unit))
     elif crit_lower != None and value <= crit_lower:
         state = 2
-        infotext += " (too low: critical level at %.2f%s)" % (crit_lower / factor / scale, unit)
+        infotexts.append("too low: critical level at %.2f%s" % (crit_lower / factor / scale, unit))
 
     # Warning cases
     elif warn_upper != None and value >= warn_upper:
         state = 1
-        infotext += " (warning level at %.2f%s)" % (warn_upper / factor / scale, unit)
+        infotexts.append("warning level at %.2f%s" % (warn_upper / factor / scale, unit))
     elif warn_lower != None and value <= warn_lower:
         state = 1
-        infotext += " (too low: warning level at %.2f%s)" % (warn_lower / factor / scale, unit)
+        infotexts.append("too low: warning level at %.2f%s" % (warn_lower / factor / scale, unit))
 
     # OK
     else:
         state = 0
 
+    if infotexts:
+        infotext = " (" + ", ".join(infotexts) + ")"
+    else:
+        infotext = ""
+
     if state and statemarkers:
         if state == 1:
             infotext += "(!)"



More information about the checkmk-commits mailing list