Module: check_mk
Branch: master
Commit: e69a3836094658df80855815de48eac444c712c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e69a3836094658…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 28 09:41:28 2016 +0200
3446 mssql_version: Outputs info about cluster state and cluster name
---
.werks/3446 | 9 +++++++++
ChangeLog | 1 +
agents/windows/plugins/mssql.vbs | 8 +++++---
checks/mssql_versions | 19 +++++++++++++------
4 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/.werks/3446 b/.werks/3446
new file mode 100644
index 0000000..63eeef8
--- /dev/null
+++ b/.werks/3446
@@ -0,0 +1,9 @@
+Title: mssql_version: Outputs info about cluster state and cluster name
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1461829269
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 9ab192d..84873f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,7 @@
* 3428 bluenet2_powerrail, bluenet2_powerrail.rcm, bluenet2_powerrail.temp,
bluenet2_powerrail.humidity: new checks for Bachmann Bluenet2 Powerrails which support the
BACHMANN-bluenet2-MIB
* 3524 fileinfo, fileinfo.groups: both checks are now cluster ready...
* 3445 mssql_versions: With up-to-date agent plugin it is now writing out the used
edition
+ * 3446 mssql_version: Outputs info about cluster state and cluster name
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index 897559e..28c171f 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -117,14 +117,13 @@ For i = LBound(value_names) To UBound(value_names)
instance_name & "\Setup", _
"Edition", edition
- addOutput("<<<mssql_versions:sep(124)>>>")
- addOutput("MSSQL_" & instance_id & "|" & version
& "|" & edition)
-
' Check whether or not this instance is clustered
registry.GetStringValue HKLM, "SOFTWARE\Microsoft\Microsoft SQL Server\"
& _
instance_name & "\Cluster",
"ClusterName", cluster_name
If IsNull(cluster_name) Then
+ cluster_name = ""
+
' In case of instance name "MSSQLSERVER" always use (local) as
connect string
If instance_id = "MSSQLSERVER" Then
sources.add instance_id, "(local)"
@@ -140,6 +139,9 @@ For i = LBound(value_names) To UBound(value_names)
End If
End If
+ addOutput("<<<mssql_versions:sep(124)>>>")
+ addOutput("MSSQL_" & instance_id & "|" & version
& "|" & edition & "|" & cluster_name)
+
' Only collect results for currently running instances
Set service = WMI.ExecQuery("SELECT State FROM Win32_Service " & _
"WHERE Name = 'MSSQL$" & instance_id &
"' AND State = 'Running'")
diff --git a/checks/mssql_versions b/checks/mssql_versions
index 74d23ab..d435761 100644
--- a/checks/mssql_versions
+++ b/checks/mssql_versions
@@ -30,22 +30,29 @@
# 1.4.0i1 output
# <<<mssql_versions:sep(124)>>>
-# MSSQL_MSSQLSERVER|10.50.1600.1|Enterprise Edition
+# MSSQL_MSSQLSERVER|10.50.1600.1|Enterprise Edition|ZMUCSQLCTX
def inventory_mssql_versions(info):
inventory = []
for line in info:
- if len(line) in [2, 3] and line[0] != "Error:":
+ if len(line) in [2, 4] and line[0] != "Error:":
inventory.append((line[0], None))
return inventory
def check_mssql_versions(item, _unused, info):
for line in info:
if line[0] == item:
- if len(line) == 2:
- return 0, 'Server is running version %s' % line[1]
- else:
- return 0, 'Server is running %s in version %s' % (line[2],
line[1])
+ if len(line) >= 2:
+ yield 0, 'Server is running version %s' % line[1]
+
+ if len(line) == 4:
+ yield 0, line[2] # edition
+
+ if line[3] != "":
+ yield 0, "clustered as %s" % line[3]
+
+ return
+
check_info["mssql_versions"] = {
'check_function': check_mssql_versions,