Module: check_mk
Branch: master
Commit: 51828eddb9d36cd3a9dace91a2de41d7d7ad121d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=51828eddb9d36c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 2 14:08:49 2012 +0200
Improved mssql agent plugin
* FIX: mssql agent: Fixed connection to default instances ("MSSQLSERVER")
* FIX: mssql agent: Fixed check of databases with names starting with numbers
---
ChangeLog | 2 ++
agents/windows/plugins/mssql.vbs | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 60b5039..dad3486 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,8 @@
* vms_system.procs: new check for number of processes on OpenVMS
* vms_queuejobs: new check for monitoring current VMS queue jobs
* FIX: mssql agent: Added compatibility code for MSSQL 9
+ * FIX: mssql agent: Fixed connection to default instances ("MSSQLSERVER")
+ * FIX: mssql agent: Fixed check of databases with names starting with numbers
* f5_bigip_temp: add performance data
* added perf-o-meters for a lot of temperature checks
* cmctc_lcp.*: added new checks for Rittal CMC-TC LCP
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index 7e12135..318b7b2 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -82,7 +82,14 @@ For Each instId In instIds.Keys
Else
instName = instId
End If
- CONN.Properties("Data Source").Value = hostname & "\" &
instName
+
+ ' In case of instance name "MSSQLSERVER" always use (local) as connect
string
+ If instName = "MSSQLSERVER" Then
+ CONN.Properties("Data Source").Value = "(local)"
+ Else
+ CONN.Properties("Data Source").Value = hostname & "\"
& instName
+ End If
+
CONN.Open
' Get counter data for the whole instance
@@ -120,7 +127,7 @@ For Each instId In instIds.Keys
Dim i, dbSize, unallocated, reserved, data, indexSize, unused
For Each dbName in dbNames.Keys
' Switch to other database and then ask for stats
- RS.Open "USE " & dbName, CONN
+ RS.Open "USE [" & dbName & "]", CONN
' sp_spaceused is a stored procedure which returns two selects
' which need to be looped
RS.Open "EXEC sp_spaceused", CONN