From b96e12aba1aabe510d680ca3ff9635a7e286f435 Mon Sep 17 00:00:00 2001 From: Lukasz Jagiello Date: Wed, 4 May 2016 12:20:13 +0000 Subject: [PATCH] Fix #1148 - chatty MySQL Two additional config options to reduce MySQL metrics With: - gather_table_lock_waits = false - gather_event_waits = false ``` | wc -l 34 ``` With: - gather_table_lock_waits = true - gather_event_waits = true ``` | wc -l 50040 ``` --- etc/telegraf.conf | 6 ++++++ plugins/inputs/mysql/README.md | 6 ++++++ plugins/inputs/mysql/mysql.go | 24 ++++++++++++++++++------ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/etc/telegraf.conf b/etc/telegraf.conf index f57bd1410..ee6b69aa0 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -879,9 +879,15 @@ # ## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMART_BY_TABLE # gather_table_io_waits = false # # +# ## gather metrics from PERFORMANCE_SCHEMA.TABLE_LOCK_WAITS +# gather_table_lock_waits = false +# # # ## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMART_BY_INDEX_USAGE # gather_index_io_waits = false # # +# ## gather metrics from PERFORMANCE_SCHEMA.EVENT_WAITS +# gather_event_waits = false +# # # ## gather metrics from PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME # gather_file_events_stats = false # # diff --git a/plugins/inputs/mysql/README.md b/plugins/inputs/mysql/README.md index d6f16b398..7c702568f 100644 --- a/plugins/inputs/mysql/README.md +++ b/plugins/inputs/mysql/README.md @@ -56,9 +56,15 @@ This plugin gathers the statistic data from MySQL server ## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMART_BY_TABLE gather_table_io_waits = false # + ## gather metrics from PERFORMANCE_SCHEMA.TABLE_LOCK_WAITS + gather_table_lock_waits = false + # ## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMART_BY_INDEX_USAGE gather_index_io_waits = false # + ## gather metrics from PERFORMANCE_SCHEMA.EVENT_WAITS + gather_event_waits = false + # ## gather metrics from PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME gather_file_events_stats = false # diff --git a/plugins/inputs/mysql/mysql.go b/plugins/inputs/mysql/mysql.go index bbc716405..cf1854827 100644 --- a/plugins/inputs/mysql/mysql.go +++ b/plugins/inputs/mysql/mysql.go @@ -25,7 +25,9 @@ type Mysql struct { GatherSlaveStatus bool `toml:"gather_slave_status"` GatherBinaryLogs bool `toml:"gather_binary_logs"` GatherTableIOWaits bool `toml:"gather_table_io_waits"` + GatherTableLockWaits bool `toml:"gather_table_lock_waits"` GatherIndexIOWaits bool `toml:"gather_index_io_waits"` + GatherEventWaits bool `toml:"gather_event_waits"` GatherTableSchema bool `toml:"gather_table_schema"` GatherFileEventsStats bool `toml:"gather_file_events_stats"` GatherPerfEventsStatements bool `toml:"gather_perf_events_statements"` @@ -68,9 +70,15 @@ var sampleConfig = ` ## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMART_BY_TABLE gather_table_io_waits = false # + ## gather metrics from PERFORMANCE_SCHEMA.TABLE_LOCK_WAITS + gather_table_lock_waits = false + # ## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMART_BY_INDEX_USAGE gather_index_io_waits = false # + ## gather metrics from PERFORMANCE_SCHEMA.EVENT_WAITS + gather_event_waits = false + # ## gather metrics from PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME gather_file_events_stats = false # @@ -612,14 +620,18 @@ func (m *Mysql) gatherServer(serv string, acc telegraf.Accumulator) error { } } - err = m.gatherPerfTableLockWaits(db, serv, acc) - if err != nil { - return err + if m.GatherTableLockWaits { + err = m.gatherPerfTableLockWaits(db, serv, acc) + if err != nil { + return err + } } - err = m.gatherPerfEventWaits(db, serv, acc) - if err != nil { - return err + if m.GatherEventWaits { + err = m.gatherPerfEventWaits(db, serv, acc) + if err != nil { + return err + } } if m.GatherFileEventsStats {