Module: check_mk
Branch: master
Commit: 1df1494d11a10693a13d787317dd7f94ca0048de
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1df1494d11a106…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 8 11:11:07 2015 +0200
New helper function tryint() for usage in checks
---
modules/check_mk_base.py | 10 ++++++++++
web/plugins/metrics/check_mk.py | 1 -
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 90100a2..746b585 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1888,6 +1888,16 @@ def saveint(i):
except:
return 0
+# This variant of int() lets the string if its not
+# convertable. Useful for parsing dict-like things, where
+# some of the values are int.
+def tryint(x):
+ try:
+ return int(x)
+ except:
+ return x
+
+
def savefloat(f):
try:
return float(f)
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 3156829..06205d7 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -430,7 +430,6 @@ metric_info["mem_lnx_vmalloc_chunk"] = {
"unit" : "bytes",
}
-
metric_info["execution_time"] = {
"title" : _("Execution time"),
"unit" : "s",