Module: check_mk
Branch: master
Commit: 152f8b0a5e0acc918ae9bf24d5adcc180b4cc302
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=152f8b0a5e0acc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 27 15:39:47 2015 +0200
The mysql checks support monitoring multiple instances per host since some versions. There
was a bug when
only a single instance is running on a host where an empty instance id is reported by the
agent. The checks
were discoverying wrong service names and resulting in exceptions during checking.
Conflicts:
ChangeLog
checks/mysql_slave
---
.werks/2547 | 12 ++++++++++++
ChangeLog | 1 +
checks/mysql | 3 +++
checks/mysql_capacity | 10 ++++++++++
checks/mysql_ping | 3 +++
checks/mysql_slave | 3 +++
6 files changed, 32 insertions(+)
diff --git a/.werks/2547 b/.werks/2547
new file mode 100644
index 0000000..97a1488
--- /dev/null
+++ b/.werks/2547
@@ -0,0 +1,12 @@
+Title: mysql mysql_capacity mysql_ping mysql_slave: Fixed broken service discovery when
instance id is empty
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1440682635
+
+The mysql checks support monitoring multiple instances per host since some versions.
There was a bug when
+only a single instance is running on a host where an empty instance id is reported by the
agent. The checks
+were discoverying wrong service names and resulting in exceptions during checking.
diff --git a/ChangeLog b/ChangeLog
index 55443fe..32a70b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -145,6 +145,7 @@
* 1287 FIX: akcp_temperature: Fixed interpretation of device levels...
* 2545 FIX: akcp_daisy_temp: sensorProbe8-X20 not trying to discover services on
these devices
* 2546 FIX: brocade_mlx_power: Only discover power supplies in state normal/failure,
skip other states...
+ * 2547 FIX: mysql mysql_capacity mysql_ping mysql_slave: Fixed broken service
discovery when instance id is empty...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checks/mysql b/checks/mysql
index dd670cb..11ed3f2 100644
--- a/checks/mysql
+++ b/checks/mysql
@@ -53,6 +53,7 @@ def inventory_mysql(parsed):
if len(values.keys()) > 200: # should be at least 321 line
return [(instance, {})]
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql(info):
def parse_line(line):
if len(line) == 2:
@@ -71,6 +72,8 @@ def parse_mysql(info):
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = {}
elif instance:
varname, value = parse_line(line)
diff --git a/checks/mysql_capacity b/checks/mysql_capacity
index ca6d358..3f42989 100644
--- a/checks/mysql_capacity
+++ b/checks/mysql_capacity
@@ -32,13 +32,23 @@
# performance_schema 0 0
# wa-confluence 15499264 13805551616
+# new: can have instance headers (can be empty), e.g.:
+# <<<mysql_capacity>>>
+# [[]]
+# information_schema 147456 0
+# mysql 665902 292
+# performance_schema 0 0
+# test 409255936 54525952
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql_capacity(info):
parsed = {}
instance = False
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = []
elif instance:
parsed[instance].append(line)
diff --git a/checks/mysql_ping b/checks/mysql_ping
index c116fbd..c4033b5 100644
--- a/checks/mysql_ping
+++ b/checks/mysql_ping
@@ -35,12 +35,15 @@
# "error: 'Access denied for user
'root'@'localhost' (using password: NO)'" ]
# }
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql_ping(info):
parsed = {}
instance = False
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = []
elif instance:
parsed[instance].append(" ".join(line))
diff --git a/checks/mysql_slave b/checks/mysql_slave
index 64edea4..f07b3c8 100644
--- a/checks/mysql_slave
+++ b/checks/mysql_slave
@@ -24,6 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql_slave(info):
def parse_line(l):
if ':' in l[0]:
@@ -49,6 +50,8 @@ def parse_mysql_slave(info):
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = {}
elif instance:
key, value = parse_line(line)