Module: check_mk
Branch: master
Commit: 72e294e054dd758e922b0cbae89b7b6e6889926c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=72e294e054dd75…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Oct 14 15:45:36 2016 +0200
3824 FIX netapp_api_snapvault: fixed duplicate service when item name contains a $
character
$ characters are now replaced with _.
---
.werks/3824 | 9 +++++++++
ChangeLog | 1 +
checks/netapp_api.include | 5 ++++-
checks/netapp_api_snapvault | 4 ++++
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/.werks/3824 b/.werks/3824
new file mode 100644
index 0000000..54aa118
--- /dev/null
+++ b/.werks/3824
@@ -0,0 +1,9 @@
+Title: netapp_api_snapvault: fixed duplicate service when item name contains a $
character
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i2
+Date: 1476452646
+Class: fix
+
+$ characters are now replaced with _.
diff --git a/ChangeLog b/ChangeLog
index a0cf2e8..a002661 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 3649 FIX: Added a workaround for an escaping-related bug in old bash versions...
* 3958 FIX: netapp_qtree_quota: fixed graph scaling
* 3823 FIX: The windows agent were unable to execute powershell, python and pearl
scripts
+ * 3824 FIX: netapp_api_snapvault: fixed duplicate service when item name contains a $
character...
Multisite:
* 3897 FIX: Fixed possible exception in raw edition when rendering graphs
diff --git a/checks/netapp_api.include b/checks/netapp_api.include
index b313467..2310e17 100644
--- a/checks/netapp_api.include
+++ b/checks/netapp_api.include
@@ -27,7 +27,7 @@
# Transforms all lines into a dictionary.
# The first key is the dictionary key, unless modified by the custom_keys
-def netapp_api_parse_lines(info, custom_keys = [], as_dict_list = False):
+def netapp_api_parse_lines(info, custom_keys = [], as_dict_list = False, item_func =
None):
instances = {}
for line in info:
instance = {}
@@ -43,6 +43,9 @@ def netapp_api_parse_lines(info, custom_keys = [], as_dict_list =
False):
custom_name.append(instance[key])
name = ".".join(custom_name)
+ if item_func:
+ name = item_func(name)
+
if as_dict_list:
instances.setdefault(name, [])
instances[name].append(instance)
diff --git a/checks/netapp_api_snapvault b/checks/netapp_api_snapvault
index d84f46d..957d134 100644
--- a/checks/netapp_api_snapvault
+++ b/checks/netapp_api_snapvault
@@ -72,8 +72,12 @@ def check_netapp_api_snapvault(item, params, parsed):
yield state, "Lag-Time: %s" % get_age_human_readable(lag_time)
+def netapp_api_snapvault_item(name):
+ return name.replace("$", "_")
+
check_info["netapp_api_snapvault"] = {
'parse_function' : netapp_api_parse_lines,
+ 'parse_function' : lambda x: netapp_api_parse_lines(x, item_func =
netapp_api_snapvault_item),
'check_function' : check_netapp_api_snapvault,
'inventory_function' : inventory_netapp_api_snapvault,
'group' : "snapvault",