Module: check_mk
Branch: master
Commit: c35a42b07a9d22771e82ce61e071229209b9e6be
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c35a42b07a9d22…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Feb 22 10:09:32 2019 +0100
mssql_counters: prepare parse function to ignore err msg
CMK-1570
Change-Id: I541d18f0bafd0e6036c42c78e5bba2d647769308
---
checks/mssql_counters | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/checks/mssql_counters b/checks/mssql_counters
index c38fe47..01c0d1f 100644
--- a/checks/mssql_counters
+++ b/checks/mssql_counters
@@ -77,16 +77,14 @@ def inventory_mssql_counters_generic(parsed, want_counters,
dflt=None):
def parse_mssql_counters_base(info):
parsed = {}
for line in info:
- node_name = line[0]
- line = line[1:]
- if len(line) < 3:
+ if len(line) < 4 or line[-1].startswith("ERROR: "):
continue
- obj, counter, instance = line[:3]
+ (node_name, obj, counter, instance), values = line[:4], line[4:]
+
if obj.endswith(':Databases'):
obj = obj[:-10]
- values = line[3:]
if len(values) == 1:
values = values[0]
try:
@@ -110,17 +108,16 @@ def parse_mssql_counters_base(info):
except ValueError:
pass
- data = parsed.setdefault((obj, instance), {})\
- .setdefault(node_name, {})
+ data = parsed.setdefault((obj, instance), {}).setdefault(node_name, {})
data.setdefault(counter, values)
return parsed
-def inventory_mssql_counters_base(parsed):
- return []
+def inventory_mssql_counters_base(_parsed):
+ return
-def check_mssql_counters_base(item, params, parsed):
+def check_mssql_counters_base(_item, _params, _parsed):
return 3, 'Not implemented check plugin'