Module: check_mk
Branch: master
Commit: 39db43cf8adb97d0629f8b769e1190c063624f04
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=39db43cf8adb97…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Nov 24 11:56:33 2015 +0100
#2800 FIX mk_mysql: fixed some issues with incorrect assembled command line
This plugin tries to detect the correct command line out of the command line for the
mysqld.exe.
There were some instances where this mechanism failed.
---
.werks/2800 | 11 +++++++++++
ChangeLog | 1 +
agents/windows/plugins/mk_mysql.vbs | 12 +++++++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/.werks/2800 b/.werks/2800
new file mode 100644
index 0000000..d13f6ff
--- /dev/null
+++ b/.werks/2800
@@ -0,0 +1,11 @@
+Title: mk_mysql: fixed some issues with incorrect assembled command line
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1448362357
+Class: fix
+
+This plugin tries to detect the correct command line out of the command line for the
mysqld.exe.
+There were some instances where this mechanism failed.
+
diff --git a/ChangeLog b/ChangeLog
index e331831..9dace45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -98,6 +98,7 @@
* 2798 FIX: netapp_api_cpu: fixed incorrect scaling of CPU data in NetApp
Clustermode...
* 2799 FIX: check_mail_loop: "Use TLS over SMTP" option did not work
* 2777 FIX: check_mk_agent.linux: avoid execution of .deb temporary files as plugins
+ * 2800 FIX: mk_mysql: fixed some issues with incorrect assembled command line...
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/agents/windows/plugins/mk_mysql.vbs b/agents/windows/plugins/mk_mysql.vbs
index 8c26dab..7999b41 100644
--- a/agents/windows/plugins/mk_mysql.vbs
+++ b/agents/windows/plugins/mk_mysql.vbs
@@ -94,6 +94,15 @@ For Each instance In instances.Keys
pos = InStrRev(output, vbCrLf, Len(output)-1)
conn_args = Mid(output, pos+2, Len(output)-pos-4)
+ Dim RegEx : Set RegEx = New RegExp
+ RegEx.Pattern = "(--port=.*?) "
+
+ If RegEx.Test(conn_args) Then
+ conn_args = RegEx.Execute(conn_args)(0).SubMatches(0)
+ Else
+ conn_args = ""
+ End If
+
' Now we try to construct a mysql.exe client command which is able to connect to
this database
' based on the command uses by the database service.
' In our development setup, where MySQL 5.6 has been used, the server command
is:
@@ -101,7 +110,8 @@ For Each instance In instances.Keys
' To get the client command we simply need to replace mysqld.exe with mysql.exe,
remove the
' my.ini and instance name from the end of the command and add our config as
--defaults-extra-file.
cmd = instances.Item(instance)
- cmd = Replace(cmd, "mysqld.exe", "mysql.exe")
+ cmd = Replace(cmd, "mysqld""", "mysql""")
+ cmd = Replace(cmd, "mysql""",
"mysql.exe""")
cmd = Left(cmd, InStr(cmd, "mysql.exe""")+9)
If cfg_file <> "" Then
cmd = cmd & " --defaults-extra-file=""" & cfg_file
& """"