From 8b687a8e2137f8ce08fbbb127819756b3ea866d9 Mon Sep 17 00:00:00 2001
From: Daniel Nelson <daniel.nelson@influxdb.com>
Date: Fri, 4 May 2018 14:31:16 -0700
Subject: [PATCH] Only lowercase mysql slave metrics with metric_version = 2

---
 plugins/inputs/mysql/mysql.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/inputs/mysql/mysql.go b/plugins/inputs/mysql/mysql.go
index a2be5848..6e5a89e3 100644
--- a/plugins/inputs/mysql/mysql.go
+++ b/plugins/inputs/mysql/mysql.go
@@ -608,7 +608,9 @@ func (m *Mysql) gatherSlaveStatuses(db *sql.DB, serv string, acc telegraf.Accumu
 		}
 		// range over columns, and try to parse values
 		for i, col := range cols {
-			col = strings.ToLower(col)
+			if m.MetricVersion >= 2 {
+				col = strings.ToLower(col)
+			}
 			if value, ok := m.parseValue(*vals[i].(*sql.RawBytes)); ok {
 				fields["slave_"+col] = value
 			}
-- 
GitLab