[checkmk-commits] Check_MK Git: check_mk: Internal code cleanup in new metrics module

Mathias Kettner mk at mathias-kettner.de
Thu Feb 5 15:58:32 CET 2015


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

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Thu Feb  5 15:58:29 2015 +0100

Internal code cleanup in new metrics module

---

 web/htdocs/metrics.py           |    6 +++---
 web/plugins/views/perfometer.py |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 8b5ace4..eb156ca 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -97,7 +97,7 @@ def parse_perf_data(perf_data_string, check_command=None):
 # Simple example for perf_data: [(u'temp', u'48', u'', u'70', u'80', u'', u'')]
 # Result for this example:
 # { "temp" : "value" : 48.0, "warn" : 70.0, "crit" : 80.0, "unit" : { ... } }
-def translate_metrics(check_command, perf_data):
+def translate_metrics(perf_data, check_command):
     if check_command not in check_metrics:
         return None
 
@@ -152,7 +152,7 @@ def translate_metrics(check_command, perf_data):
         # TODO: warn, crit, min, max
         # if entry[2]:
         #     # TODO: lower and upper levels
-        #     translate_metrics[metric_name]["warn"] = float(entry[2])
+        #     translated_metrics[metric_name]["warn"] = float(entry[2])
     return translated_metrics
 
 
@@ -311,7 +311,7 @@ def page_pnp_template():
     if not perf_data or not check_command:
         return
 
-    translated_metrics = translate_metrics(check_command, perf_data)
+    translated_metrics = translate_metrics(perf_data, check_command)
     if not translated_metrics:
         return # check not supported
 
diff --git a/web/plugins/views/perfometer.py b/web/plugins/views/perfometer.py
index 64dbf10..7a24122 100644
--- a/web/plugins/views/perfometer.py
+++ b/web/plugins/views/perfometer.py
@@ -134,7 +134,7 @@ def paint_perfometer(row):
 
     try:
         # Try new metrics module
-        translated_metrics = metrics.translate_metrics(check_command, perf_data)
+        translated_metrics = metrics.translate_metrics(perf_data, check_command)
         if translated_metrics: # definition for this check type exists
             perfometer_definitions = list(metrics.get_perfometers(translated_metrics))
             if perfometer_definitions:
@@ -231,7 +231,7 @@ multisite_painters["perfometer"] = {
                   "service_check_command", "service_pnpgraph_present", "service_plugin_output" ],
     "paint" : paint_perfometer,
     "sorter" : "svc_perf_val01",
-    "printable" : False, # No printable on PDF, only in HTML
+    "printable" : "perfometer", # Special rendering in PDFs
 }
 
 load_web_plugins("perfometer", globals())



More information about the checkmk-commits mailing list