Module: check_mk
Branch: master
Commit: 343fff53360dabd1b3cbfc9b7c35e023d143bf0e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=343fff53360dab…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Mon Sep 11 15:15:53 2017 +0200
4862 MSSQL: detect instances on non-standard TCP ports
The MSSQL plugin detects SQL instances running on non-standard TCP ports now.
Change-Id: I81272921bdc073294899c6a42de033fe2682c7b8
---
.werks/4862 | 11 +++++++++++
agents/windows/plugins/mssql.vbs | 17 +++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/.werks/4862 b/.werks/4862
new file mode 100644
index 0000000..3a35b59
--- /dev/null
+++ b/.werks/4862
@@ -0,0 +1,11 @@
+Title: MSSQL: detect instances on non-standard TCP ports
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1505135694
+Class: feature
+
+The MSSQL plugin detects SQL instances running on non-standard TCP ports now.
+
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index 738caef..d1ddb36 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -147,6 +147,11 @@ For Each rk In regkeys
registry.GetStringValue HKLM, "SOFTWARE\" & rk &
"\Microsoft\Microsoft SQL Server\" & _
instance_name & "\Cluster",
"ClusterName", cluster_name
+ ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\TCP\IPAll
+ registry.GetStringValue HKLM, "SOFTWARE\" & rk &
"\Microsoft\Microsoft SQL Server\" & _
+ instance_name &
"\MSSQLServer\SuperSocketNetLib\TCP\IPAll", _
+ "tcpPort", tcpport
+
If IsNull(cluster_name) Then
cluster_name = ""
@@ -154,14 +159,22 @@ For Each rk In regkeys
If instance_id = "MSSQLSERVER" Then
sources.add instance_id, "(local)"
Else
- sources.add instance_id, hostname & "\" &
instance_id
+ If isNull(tcpport) Then
+ sources.add instance_id, hostname & "\" &
instance_id
+ Else
+ sources.add instance_id, hostname & "," &
tcpport
+ End If
End If
Else
' In case the instance name is "MSSQLSERVER" always use the
virtual server name
If instance_id = "MSSQLSERVER" Then
sources.add instance_id, cluster_name
Else
- sources.add instance_id, cluster_name & "\" &
instance_id
+ If isNull(tcpport) Then
+ sources.add instance_id, cluster_name & "\" &
instance_id
+ Else
+ sources.add instance_id, cluster_name & "," &
tcpport
+ End If
End If
End If