Module: check_mk
Branch: master
Commit: c84b24700dd2a23bd0812e5567f8fdcc06323f68
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c84b24700dd2a2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 7 17:49:40 2015 +0200
Fix problem with translation of silly perf variables of df checks
---
web/htdocs/metrics.py | 13 ++++++++++---
web/plugins/metrics/check_mk.py | 4 ++--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index ac48d1f..29ac803 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -160,10 +160,17 @@ def translate_metrics(perf_data, check_command):
translated_metrics = {}
for nr, entry in enumerate(perf_data):
varname = entry[0]
- if nr in cm:
- translation_entry = cm[nr] # access by index of perfdata (e.g. in
filesystem)
+
+ translation_entry = {} # Default: no translation neccessary
+
+ if varname in cm:
+ translation_entry = cm[varname]
else:
- translation_entry = cm.get(varname, {})
+ for orig_varname, te in cm.items():
+ if orig_varname[0] == "~" and
regex(orig_varname[1:]).match(varname): # Regex entry
+ translation_entry = te
+ break
+
# Translate name
metric_name = translation_entry.get("name", varname)
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 47e440d..3156829 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -1133,7 +1133,7 @@ check_metrics["check_mk-tcp_conn_stats"] = {
}
df_translation = {
- 0 : { "name" : "fs_used", "scale" : MB },
+ "~[_/]" : { "name" : "fs_used", "scale" :
MB },
"fs_size" : { "scale" : MB },
"growth" : { "name" : "fs_growth", "scale"
: MB / 86400.0 },
"trend" : { "name" : "fs_trend", "scale" :
MB / 86400.0 },
@@ -1288,7 +1288,7 @@ check_metrics["check_mk-postgres_sessions"]
= { "total": {"n
check_metrics["check_mk-db2_bp_hitratios"] = {}
check_metrics["check_mk-db2_connections"] = {}
check_metrics["check_mk-db2_counters"] = {}
-check_metrics["check_mk-db2_logsize"] = { 0: {
"name": "fs_used", "scale" : MB } }
+check_metrics["check_mk-db2_logsize"] = {
"~[_/]": { "name": "fs_used", "scale" : MB } }
check_metrics["check_mk-db2_sort_overflow"] = {}
check_metrics["check_mk-db2_tablespaces"] = {}
check_metrics["check_mk-siemens_plc.temp"] = {}