Package: munin-plugins-core
Version: 2.0.33-1
Severity: minor
Tags: patch

Hello!

I've upgraded my MySQL VM from Jessie to Stretch.

The plugin calls innodb_free_old() instead of innodb_free_new() at
MariaDB 10.1, therefore the output of this plugin is empty. The version
comparison seems to be broken. Quick workaround as patch attached.


Regards,
Christian
--- /usr/share/munin/plugins/mysql_innodb	2018-06-17 15:35:08.534291728 +0200
+++ /usr/local/share/munin/plugins/mysql_innodb	2018-06-17 16:21:31.082863261 +0200
@@ -180,7 +180,7 @@ mysql_version() {
 # InnoDB free bytes for MySQL 5.1 and newer
 innodb_free_new() {
     t=$($MEXEC "SELECT count(*) FROM tables WHERE ENGINE = 'InnoDB';")
-    if [ "$t" ">" "0" ]; then
+    if [ "$t" -gt "0" ]; then
 	$MEXEC "SELECT data_free FROM tables WHERE ENGINE = 'InnoDB' LIMIT 1;"
     else
 	echo >&2 "$0: Error: No visible tables use InnoDB"
@@ -198,7 +198,8 @@ innodb_free_old() {
 # InnoDB free bytes wrapper
 innodb_free() {
     ver=$(mysql_version)
-    if [ "$ver" ">" "5.0" ]; then
+    mver=$(echo "$ver" | awk '{printf "%d", $1}')
+    if [ "$mver" -gt "5" ]; then
 		case $ver in
 			5.0.*|5.1.?|5.1.1?|5.1.2[0123])
 				innodb_free_old

Reply via email to