[checkmk-commits] Check_MK Git: check_mk: New Helper function for perf data

git version control git at mathias-kettner.de
Thu May 12 16:11:25 CEST 2011


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

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Thu May 12 16:11:20 2011 +0200

New Helper function for perf data

---

 modules/check_mk_base.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index e8d14d9..afe44e0 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -898,6 +898,11 @@ def convert_perf_value(x):
     else:
         return str(x)
 
+def convert_perf_data(p):
+    # replace None with "" and fill up to 7 values
+    p = (map(convert_perf_value, p) + ['','','',''])[0:6]
+    return "%s=%s;%s;%s;%s;%s" %  tuple(p)
+
 
 def submit_check_result(host, servicedesc, result, sa):
     global nagios_command_pipe
@@ -924,9 +929,8 @@ def submit_check_result(host, servicedesc, result, sa):
             check_command = None
 
         for p in perfdata:
-            # replace None with "" and fill up to 6 values
-            p = (map(convert_perf_value, p) + ['','','',''])[0:6]
-            perftexts.append("%s=%s;%s;%s;%s;%s" %  tuple(p) )
+            perftexts.append(convert_perf_data(p))
+
         if perftexts != [] and not direct_rrd_update(host, servicedesc, perfdata):
             if check_command and perfdata_format == "pnp":
                 perftexts.append("[%s]" % check_command)



More information about the checkmk-commits mailing list