Module: check_mk
Branch: master
Commit: f5bcd78e32c873f6b0f5c503d31ce05ab732f99e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f5bcd78e32c873…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jun 25 14:33:06 2018 +0200
6138 FIX mssql_instance: Fixed displaying wrong version
Change-Id: I39cbadcfceeaab0071a72c84139a97d1f22b3788
---
.werks/6138 | 13 +++++++++++++
agents/windows/plugins/mssql.vbs | 8 ++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/.werks/6138 b/.werks/6138
new file mode 100644
index 0000000..334b08b
--- /dev/null
+++ b/.werks/6138
@@ -0,0 +1,13 @@
+Title: mssql_instance: Fixed displaying wrong version
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1529929899
+Class: fix
+
+Before the version info came from
+{{Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\CurrentVersion}}.
+Now we get the version info from {{Microsoft SQL Server\Setup}}.
+
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index fe7888e..ef30a2d 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -134,10 +134,10 @@ For Each rk In regkeys
"Instance Names\SQL", _
instance_id, instance_name
- ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\CurrentVersion
+ ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\Setup
registry.GetStringValue HKLM, "SOFTWARE\" & rk &
"\Microsoft\Microsoft SQL Server\" & _
- instance_name &
"\MSSQLServer\CurrentVersion", _
- "CurrentVersion", version
+ instance_name & "\Setup", _
+ "Version", version
' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\Setup
registry.GetStringValue HKLM, "SOFTWARE\" & rk &
"\Microsoft\Microsoft SQL Server\" & _
@@ -185,7 +185,7 @@ For Each rk In regkeys
' Only collect results for instances which services are currently
running
Set service = WMI.ExecQuery("SELECT State FROM Win32_Service "
& _
"WHERE Name = 'MSSQL$" & instance_id
& "' AND State = 'Running' OR Name = 'MSSQLSERVER' AND State
= 'Running'")
- If Not IsNull(service) Then
+ If service.count > 0 Then
instances.add instance_id, cluster_name
End If
Next