Module: check_mk
Branch: master
Commit: cc88eeeb0fc26708327ea6338c06d80669625c3d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cc88eeeb0fc267…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 29 08:49:53 2017 +0200
LDAP query: Do not retry queries when implicit_connect is disabled
Change-Id: I3ec7aa440793cf7b5f3ba32f192c9c70c11b3822
---
web/plugins/userdb/ldap.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 35ff1ad..8973be6 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -566,7 +566,8 @@ class LDAPUserConnector(UserConnector):
# In some environments, the connection to the LDAP server does not seem to
# be as stable as it is needed. So we try to repeat the query for three times.
- tries_left = 2
+ # -> Don't retry when implicit connect is disabled
+ tries_left = 2 if implicit_connect else 0
success = False
last_exc = None
while not success:
Module: check_mk
Branch: master
Commit: 703d76f8b3422d19d090145745859793c8f1b5e9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=703d76f8b3422d…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Mon Aug 28 15:30:46 2017 +0200
4859 FIX MSSQL: plugin detects 32bit and 64bit instances now
Previously the plugin did not detect 32bit instances on 64bit OS. This has been fixed now.
Change-Id: Iae24b05e6ea16a2b6de957509eb86f847698cfe8
---
.werks/4859 | 19 +++++++
agents/windows/plugins/mssql.vbs | 119 ++++++++++++++++++++++-----------------
2 files changed, 86 insertions(+), 52 deletions(-)
diff --git a/.werks/4859 b/.werks/4859
new file mode 100644
index 0000000..1f92dfb
--- /dev/null
+++ b/.werks/4859
@@ -0,0 +1,19 @@
+Title: MSSQL: plugin detects 32bit and 64bit instances now
+Level: 2
+Component: checks
+<<<<<<< HEAD
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1503906598
+=======
+Compatible: compat
+Edition: cre
+Version: 1.4.0p10
+Date: 1503906598
+Class: fix
+>>>>>>> bf0efbc... 4859 FIX MSSQL: plugin detects 32bit and 64bit instances now
+
+Previously the plugin did not detect 32bit instances on 64bit OS. This has been fixed now.
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index 0b592d1..738caef 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -81,18 +81,6 @@ Set sources = CreateObject("Scripting.Dictionary")
Dim service, i, version, edition, value_types, value_names, value_raw, cluster_name
Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
-'
-' Gather instances on this host, store instance in instances and output version section for it
-'
-registry.EnumValues HKLM, "SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL", _
- value_names, value_types
-
-If Not IsArray(value_names) Then
- addOutput("<<<mssql_instance:sep(124)>>>")
- addOutput("ERROR: Failed to gather SQL server instances")
- wscript.quit(1)
-End If
-
' Make sure that always all sections are present, even in case of an error.
' Note: the section <<<mssql_instance>>> section shows the general state
' of a database instance. If that section fails for an instance then all
@@ -118,56 +106,83 @@ For Each section_id In sections.Keys
addOutput(sections(section_id))
Next
-For i = LBound(value_names) To UBound(value_names)
- instance_id = value_names(i)
+addOutput(sections("instance"))
- registry.GetStringValue HKLM, "SOFTWARE\Microsoft\Microsoft SQL Server\" & _
- "Instance Names\SQL", _
- instance_id, instance_name
+'
+' Gather instances on this host, store instance in instances and output version section for it
+'
- ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\CurrentVersion
- registry.GetStringValue HKLM, "SOFTWARE\Microsoft\Microsoft SQL Server\" & _
- instance_name & "\MSSQLServer\CurrentVersion", _
- "CurrentVersion", version
+Dim regkeys, rk
+regkeys = Array( "", "Wow6432Node") ' gather all instances, also 32bit ones on 64bit Windows
- ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\Setup
- registry.GetStringValue HKLM, "SOFTWARE\Microsoft\Microsoft SQL Server\" & _
- instance_name & "\Setup", _
- "Edition", edition
+For Each rk In regkeys
+ Do
+ registry.EnumValues HKLM, "SOFTWARE\" & rk & "\Microsoft\Microsoft SQL Server\Instance Names\SQL", _
+ value_names, value_types
- ' Check whether or not this instance is clustered
- registry.GetStringValue HKLM, "SOFTWARE\Microsoft\Microsoft SQL Server\" & _
- instance_name & "\Cluster", "ClusterName", cluster_name
+ If Not IsArray(value_names) Then
+ 'addOutput("ERROR: Failed to gather SQL server instances: " & rk)
+ 'wscript.quit(1)
+ Exit Do
+ End If
- If IsNull(cluster_name) Then
- cluster_name = ""
+ For i = LBound(value_names) To UBound(value_names)
+ instance_id = value_names(i)
- ' In case of instance name "MSSQLSERVER" always use (local) as connect string
- If instance_id = "MSSQLSERVER" Then
- sources.add instance_id, "(local)"
- Else
- sources.add instance_id, hostname & "\" & instance_id
- 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
- End If
- End If
+ registry.GetStringValue HKLM, "SOFTWARE\" & rk & "\Microsoft\Microsoft SQL Server\" & _
+ "Instance Names\SQL", _
+ instance_id, instance_name
- addOutput(sections("instance"))
- addOutput("MSSQL_" & instance_id & "|config|" & version & "|" & edition & "|" & cluster_name)
+ ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\CurrentVersion
+ registry.GetStringValue HKLM, "SOFTWARE\" & rk & "\Microsoft\Microsoft SQL Server\" & _
+ instance_name & "\MSSQLServer\CurrentVersion", _
+ "CurrentVersion", version
- ' 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'")
- If Not IsNull(service) Then
- instances.add instance_id, cluster_name
- End If
+ ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\Setup
+ registry.GetStringValue HKLM, "SOFTWARE\" & rk & "\Microsoft\Microsoft SQL Server\" & _
+ instance_name & "\Setup", _
+ "Edition", edition
+
+ ' Check whether or not this instance is clustered
+ registry.GetStringValue HKLM, "SOFTWARE\" & rk & "\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)"
+ Else
+ sources.add instance_id, hostname & "\" & instance_id
+ 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
+ End If
+ End If
+
+ addOutput(sections("instance"))
+ addOutput("MSSQL_" & instance_id & "|config|" & version & "|" & edition & "|" & cluster_name)
+
+ ' 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'")
+ If Not IsNull(service) Then
+ instances.add instance_id, cluster_name
+ End If
+ Next
+ Loop While False
Next
+If instances.Count = 0 Then
+ addOutput("ERROR: Failed to gather SQL server instances")
+ wscript.quit(1)
+End IF
+
Set service = Nothing
Set WMI = Nothing
Set registry = Nothing