Module: check_mk
Branch: master
Commit: 824a1ce1f1524ddf724ee903edc0bb6b7c06e435
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=824a1ce1f1524d…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Dec 9 14:09:24 2013 +0100
FIX mssql: Server instances with underline in name are now supported.
Thanks to a patch from H.Schniggendiller
---
.werks/104 | 8 ++++++++
ChangeLog | 1 +
agents/windows/plugins/mssql.vbs | 21 ++++++++++++---------
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/.werks/104 b/.werks/104
new file mode 100644
index 0000000..c306f80
--- /dev/null
+++ b/.werks/104
@@ -0,0 +1,8 @@
+Title: mssql: Server instances with underline in name are now supported.
+Level: 1
+Component: checks
+Version: 1.2.3i8
+Date: 1386594495
+Class: fix
+
+Thanks to a patch from H.Schniggendiller
diff --git a/ChangeLog b/ChangeLog
index 72ef6c3..fd86410 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
* 0305 FIX: apache_status: Fixed exception when agent reports HTML code as
apache-status data...
+ * 0104 FIX: mssql: Server instances with underline in name are now supported....
Multisite:
* 0302 FIX: Fixed highlight of choosen elements in foldertee/views snapin in
Chrome/IE
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index b9fc1c9..7f508ff 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -17,11 +17,13 @@
'
' This check has been developed with MSSQL Server 2008 R2. It should work with
' older versions starting from at least MSSQL Server 2005.
+'
+' 16.10.2013 Instanzen mit Unterstrich im Namen -- H.Schniggendiller
' -----------------------------------------------------------------------------
Option Explicit
-Dim WMI, prop, instId, instVersion, instIds, instName, output, WMIservice,
colRunningServices, objService
+Dim WMI, prop, instId, instIdx, instVersion, instIds, instName, output, WMIservice,
colRunningServices, objService
WScript.Timeout = 10
@@ -71,11 +73,11 @@ For Each prop In WMI.ExecQuery("SELECT * FROM
SqlServiceAdvancedProperty WHERE "
Set colRunningServices = WMIservice.ExecQuery("SELECT State FROM Win32_Service
WHERE Name = '" & prop.ServiceName & "'")
- instId = Replace(prop.ServiceName, "$", "_")
+ instId = Replace(prop.ServiceName, "$", "__")
instVersion = prop.PropertyStrValue
-
+ instIdx = Replace(instId, "__", "_")
addOutput( "<<<mssql_versions>>>" )
- addOutput( instId & " " & instVersion )
+ addOutput( instIdx & " " & instVersion )
' Now query the server instance for the databases
' Use name as key and always empty value for the moment
@@ -106,9 +108,10 @@ For Each instId In instIds.Keys
' At this place one could implement to use other authentication mechanism
CONN.Properties("Integrated Security").Value = "SSPI"
- If InStr(instId, "_") <> 0 Then
- instName = Split(instId, "_")(1)
- Else
+ If InStr(instId, "__") <> 0 Then
+ instName = Split(instId, "__")(1)
+ instId = Replace(instId, "__", "_")
+ Else
instName = instId
End If
@@ -117,7 +120,8 @@ For Each instId In instIds.Keys
CONN.Properties("Data Source").Value = "(local)"
Else
CONN.Properties("Data Source").Value = hostname & "\"
& instName
- End If
+ End If
+ 'WScript.echo (CONN)
CONN.Open
@@ -217,4 +221,3 @@ Set CONN = nothing
' finally output collected data
WScript.echo output
-