diff --git a/CHANGELOG.md b/CHANGELOG.md index eb42e511d..990d417e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features +- [#2137](https://github.com/influxdata/telegraf/pull/2137): Added userstats to mysql input plugin. + ### Bugfixes - [#2077](https://github.com/influxdata/telegraf/issues/2077): SQL Server Input - Arithmetic overflow error converting numeric to data type int. diff --git a/plugins/inputs/mysql/mysql.go b/plugins/inputs/mysql/mysql.go index c0a31aeed..ca169f0d4 100644 --- a/plugins/inputs/mysql/mysql.go +++ b/plugins/inputs/mysql/mysql.go @@ -683,7 +683,7 @@ func (m *Mysql) gatherGlobalVariables(db *sql.DB, serv string, acc telegraf.Accu return err } key = strings.ToLower(key) - // parse mysql version and put into field and tag + // parse mysql version and put into field and tag if strings.Contains(key, "version") { fields[key] = string(val) tags[key] = string(val) @@ -950,28 +950,28 @@ func (m *Mysql) gatherGlobalStatuses(db *sql.DB, serv string, acc telegraf.Accum tags := map[string]string{"server": servtag, "user": user} fields := map[string]interface{}{ - "total_connections": total_connections, - "concurrent_connections": concurrent_connections, - "connected_time": connected_time, - "busy_time": busy_time, - "cpu_time": cpu_time, - "bytes_received": bytes_received, - "bytes_sent": bytes_sent, - "binlog_bytes_written": binlog_bytes_written, - "rows_fetched": rows_fetched, - "rows_updated": rows_updated, - "table_rows_read": table_rows_read, - "select_commands": select_commands, - "update_commands": update_commands, - "other_commands": other_commands, - "commit_transactions": commit_transactions, - "rollback_transactions": rollback_transactions, - "denied_connections": denied_connections, - "lost_connections": lost_connections, - "access_denied": access_denied, - "empty_queries": empty_queries, - "total_ssl_connections": total_ssl_connections, - } + "total_connections": total_connections, + "concurrent_connections": concurrent_connections, + "connected_time": connected_time, + "busy_time": busy_time, + "cpu_time": cpu_time, + "bytes_received": bytes_received, + "bytes_sent": bytes_sent, + "binlog_bytes_written": binlog_bytes_written, + "rows_fetched": rows_fetched, + "rows_updated": rows_updated, + "table_rows_read": table_rows_read, + "select_commands": select_commands, + "update_commands": update_commands, + "other_commands": other_commands, + "commit_transactions": commit_transactions, + "rollback_transactions": rollback_transactions, + "denied_connections": denied_connections, + "lost_connections": lost_connections, + "access_denied": access_denied, + "empty_queries": empty_queries, + "total_ssl_connections": total_ssl_connections, + } acc.AddFields("mysql_user_stats", fields, tags) }