Bug#901729: mysql_innodb: Unusable after upgrade from Jessie to Stretch

2018-06-20 Thread Lars Kruse
Package: munin-plugins-core
Version: 2.0.37-2
Followup-For: Bug #901729

Hello Christian,

thank you for preparing the patch!

I just pushed a commit [1] fixing this issue (based on your patch) to
upstream. Thus it will be part of the release (2.0.38) of munin.

Cheers,
Lars

[1] 
https://github.com/munin-monitoring/munin/commit/455ba7e0f7887be8a449e3b72dfe6bcf0aacf9bd



Bug#901729: mysql_innodb: Unusable after upgrade from Jessie to Stretch

2018-06-17 Thread Christian Schrötter
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