Module: check_mk
Branch: master
Commit: 2778fc7f4ae9d78021f93029be90f480bebb259a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2778fc7f4ae9d7…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Jun 8 10:52:03 2017 +0200
4773 FIX mssql_instance: Added error handling if plugin fails to gather SQL server
instances
Change-Id: I6862709533d9c6b08baac6eab7883d352cbcdfa4
---
.werks/4773 | 11 +++++++++++
agents/windows/plugins/mssql.vbs | 1 +
checks/mssql_instance | 9 +++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/4773 b/.werks/4773
new file mode 100644
index 0000000..24ce3d6
--- /dev/null
+++ b/.werks/4773
@@ -0,0 +1,11 @@
+Title: mssql_instance: Added error handling if plugin fails to gather SQL server
instances
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1496911830
+
+
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index 47207ec..0b592d1 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -88,6 +88,7 @@ registry.EnumValues HKLM, "SOFTWARE\Microsoft\Microsoft SQL
Server\Instance Name
value_names, value_types
If Not IsArray(value_names) Then
+ addOutput("<<<mssql_instance:sep(124)>>>")
addOutput("ERROR: Failed to gather SQL server instances")
wscript.quit(1)
End If
diff --git a/checks/mssql_instance b/checks/mssql_instance
index 3d0bef9..4aaa042 100644
--- a/checks/mssql_instance
+++ b/checks/mssql_instance
@@ -37,12 +37,17 @@
# <<<mssql_instance:sep(124)>>>
# MSSQL_MICROSOFT##SSEE|state|0|[DBNETLIB][ConnectionOpen (Connect()).]SQL Server
existiert nicht oder Zugriff verweigert.
+# <<<mssql_instance:sep(124)>>>
+# ERROR: Failed to gather SQL server instances
+
def parse_mssql_instance(info):
parsed = {}
for line in info:
- # Remove the MSSQL_ prefix from the ID for this check
- if line[0][:6] == "MSSQL_":
+ if line[0].startswith("ERROR:"):
+ continue
+ elif line[0][:6] == "MSSQL_":
+ # Remove the MSSQL_ prefix from the ID for this check
instance_id = line[0][6:]
else:
instance_id = line[0]