diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:18 +0000 |
commit | 5da14042f70711ea5cf66e034699730335462f66 (patch) | |
tree | 0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/go/collectors/go.d.plugin/modules/mysql | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz netdata-5da14042f70711ea5cf66e034699730335462f66.zip |
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
48 files changed, 8908 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/mysql/README.md b/src/go/collectors/go.d.plugin/modules/mysql/README.md new file mode 120000 index 000000000..edf116dee --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/README.md @@ -0,0 +1 @@ +integrations/mysql.md
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/charts.go b/src/go/collectors/go.d.plugin/modules/mysql/charts.go new file mode 100644 index 000000000..054e4e01d --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/charts.go @@ -0,0 +1,1239 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "fmt" + "strings" + + "github.com/netdata/netdata/go/go.d.plugin/agent/module" +) + +const ( + prioBandwidth = module.Priority + iota + prioQueries + prioQueriesType + prioHandlers + prioTableOpenCacheOverflows + prioTableLocks + prioTableJoinIssues + prioTableSortIssues + prioTmpOperations + prioConnections + prioActiveConnections + prioBinlogCache + prioBinlogStatementCache + prioThreads + prioThreadsCreated + prioThreadCacheMisses + prioInnoDBIO + prioInnoDBIOOperations + prioInnoDBIOPendingOperations + prioInnoDBLog + prioInnoDBOSLog + prioInnoDBOSLogFsyncWrites + prioInnoDBOSLogIO + prioInnoDBCurRowLock + prioInnoDBRows + prioInnoDBBufferPoolPages + prioInnoDBBufferPoolPagesFlushed + prioInnoDBBufferPoolBytes + prioInnoDBBufferPoolReadAhead + prioInnoDBBufferPoolReadAheadRnd + prioInnoDBBufferPoolOperations + prioMyISAMKeyBlocks + prioMyISAMKeyRequests + prioMyISAMKeyDiskOperations + prioOpenFiles + prioOpenFilesRate + prioConnectionErrors + prioOpenedTables + prioOpenTables + prioProcessListFetchQueryDuration + prioProcessListQueries + prioProcessListLongestQueryDuration + prioInnoDBDeadlocks + prioQCacheOperations + prioQCacheQueries + prioQCacheFreeMem + prioQCacheMemBlocks + prioGaleraWriteSets + prioGaleraBytes + prioGaleraQueue + prioGaleraConflicts + prioGaleraFlowControl + prioGaleraClusterStatus + prioGaleraClusterState + prioGaleraClusterSize + prioGaleraClusterWeight + prioGaleraClusterConnectionStatus + prioGaleraReadinessState + prioGaleraOpenTransactions + prioGaleraThreadCount + prioSlaveSecondsBehindMaster + prioSlaveSQLIOThreadRunningState + prioUserStatsCPUTime + prioUserStatsRows + prioUserStatsCommands + prioUserStatsDeniedCommands + prioUserStatsTransactions + prioUserStatsBinlogWritten + prioUserStatsEmptyQueries + prioUserStatsConnections + prioUserStatsLostConnections + prioUserStatsDeniedConnections +) + +var baseCharts = module.Charts{ + chartBandwidth.Copy(), + chartQueries.Copy(), + chartQueriesType.Copy(), + chartHandlers.Copy(), + chartTableLocks.Copy(), + chartTableJoinIssues.Copy(), + chartTableSortIssues.Copy(), + chartTmpOperations.Copy(), + chartConnections.Copy(), + chartActiveConnections.Copy(), + chartThreads.Copy(), + chartThreadCreationRate.Copy(), + chartThreadsCacheMisses.Copy(), + chartInnoDBIO.Copy(), + chartInnoDBIOOperations.Copy(), + chartInnoDBPendingIOOperations.Copy(), + chartInnoDBLogOperations.Copy(), + chartInnoDBCurrentRowLocks.Copy(), + chartInnoDBRowsOperations.Copy(), + chartInnoDBBufferPoolPages.Copy(), + chartInnoDBBufferPoolPagesFlushed.Copy(), + chartInnoDBBufferPoolBytes.Copy(), + chartInnoDBBufferPoolReadAhead.Copy(), + chartInnoDBBufferPoolReadAheadRnd.Copy(), + chartInnoDBBufferPoolOperations.Copy(), + chartOpenFiles.Copy(), + chartOpenedFilesRate.Copy(), + chartConnectionErrors.Copy(), + chartOpenedTables.Copy(), + chartOpenTables.Copy(), + chartProcessListFetchQueryDuration.Copy(), + chartProcessListQueries.Copy(), + chartProcessListLongestQueryDuration.Copy(), +} + +var ( + chartBandwidth = module.Chart{ + ID: "net", + Title: "Bandwidth", + Units: "kilobits/s", + Fam: "bandwidth", + Ctx: "mysql.net", + Type: module.Area, + Priority: prioBandwidth, + Dims: module.Dims{ + {ID: "bytes_received", Name: "in", Algo: module.Incremental, Mul: 8, Div: 1000}, + {ID: "bytes_sent", Name: "out", Algo: module.Incremental, Mul: -8, Div: 1000}, + }, + } + chartQueries = module.Chart{ + ID: "queries", + Title: "Queries", + Units: "queries/s", + Fam: "queries", + Ctx: "mysql.queries", + Priority: prioQueries, + Dims: module.Dims{ + {ID: "queries", Name: "queries", Algo: module.Incremental}, + {ID: "questions", Name: "questions", Algo: module.Incremental}, + {ID: "slow_queries", Name: "slow_queries", Algo: module.Incremental}, + }, + } + chartQueriesType = module.Chart{ + ID: "queries_type", + Title: "Queries By Type", + Units: "queries/s", + Fam: "queries", + Ctx: "mysql.queries_type", + Type: module.Stacked, + Priority: prioQueriesType, + Dims: module.Dims{ + {ID: "com_select", Name: "select", Algo: module.Incremental}, + {ID: "com_delete", Name: "delete", Algo: module.Incremental}, + {ID: "com_update", Name: "update", Algo: module.Incremental}, + {ID: "com_insert", Name: "insert", Algo: module.Incremental}, + {ID: "com_replace", Name: "replace", Algo: module.Incremental}, + }, + } + chartHandlers = module.Chart{ + ID: "handlers", + Title: "Handlers", + Units: "handlers/s", + Fam: "handlers", + Ctx: "mysql.handlers", + Priority: prioHandlers, + Dims: module.Dims{ + {ID: "handler_commit", Name: "commit", Algo: module.Incremental}, + {ID: "handler_delete", Name: "delete", Algo: module.Incremental}, + {ID: "handler_prepare", Name: "prepare", Algo: module.Incremental}, + {ID: "handler_read_first", Name: "read first", Algo: module.Incremental}, + {ID: "handler_read_key", Name: "read key", Algo: module.Incremental}, + {ID: "handler_read_next", Name: "read next", Algo: module.Incremental}, + {ID: "handler_read_prev", Name: "read prev", Algo: module.Incremental}, + {ID: "handler_read_rnd", Name: "read rnd", Algo: module.Incremental}, + {ID: "handler_read_rnd_next", Name: "read rnd next", Algo: module.Incremental}, + {ID: "handler_rollback", Name: "rollback", Algo: module.Incremental}, + {ID: "handler_savepoint", Name: "savepoint", Algo: module.Incremental}, + {ID: "handler_savepoint_rollback", Name: "savepointrollback", Algo: module.Incremental}, + {ID: "handler_update", Name: "update", Algo: module.Incremental}, + {ID: "handler_write", Name: "write", Algo: module.Incremental}, + }, + } + chartTableOpenCacheOverflows = module.Chart{ + ID: "table_open_cache_overflows", + Title: "Table open cache overflows", + Units: "overflows/s", + Fam: "open cache", + Ctx: "mysql.table_open_cache_overflows", + Priority: prioTableOpenCacheOverflows, + Dims: module.Dims{ + {ID: "table_open_cache_overflows", Name: "open_cache", Algo: module.Incremental}, + }, + } + chartTableLocks = module.Chart{ + ID: "table_locks", + Title: "Table Locks", + Units: "locks/s", + Fam: "locks", + Ctx: "mysql.table_locks", + Priority: prioTableLocks, + Dims: module.Dims{ + {ID: "table_locks_immediate", Name: "immediate", Algo: module.Incremental}, + {ID: "table_locks_waited", Name: "waited", Algo: module.Incremental, Mul: -1}, + }, + } + chartTableJoinIssues = module.Chart{ + ID: "join_issues", + Title: "Table Select Join Issues", + Units: "joins/s", + Fam: "issues", + Ctx: "mysql.join_issues", + Priority: prioTableJoinIssues, + Dims: module.Dims{ + {ID: "select_full_join", Name: "full join", Algo: module.Incremental}, + {ID: "select_full_range_join", Name: "full range join", Algo: module.Incremental}, + {ID: "select_range", Name: "range", Algo: module.Incremental}, + {ID: "select_range_check", Name: "range check", Algo: module.Incremental}, + {ID: "select_scan", Name: "scan", Algo: module.Incremental}, + }, + } + chartTableSortIssues = module.Chart{ + ID: "sort_issues", + Title: "Table Sort Issues", + Units: "issues/s", + Fam: "issues", + Ctx: "mysql.sort_issues", + Priority: prioTableSortIssues, + Dims: module.Dims{ + {ID: "sort_merge_passes", Name: "merge passes", Algo: module.Incremental}, + {ID: "sort_range", Name: "range", Algo: module.Incremental}, + {ID: "sort_scan", Name: "scan", Algo: module.Incremental}, + }, + } + chartTmpOperations = module.Chart{ + ID: "tmp", + Title: "Tmp Operations", + Units: "events/s", + Fam: "temporaries", + Ctx: "mysql.tmp", + Priority: prioTmpOperations, + Dims: module.Dims{ + {ID: "created_tmp_disk_tables", Name: "disk tables", Algo: module.Incremental}, + {ID: "created_tmp_files", Name: "files", Algo: module.Incremental}, + {ID: "created_tmp_tables", Name: "tables", Algo: module.Incremental}, + }, + } + chartConnections = module.Chart{ + ID: "connections", + Title: "Connections", + Units: "connections/s", + Fam: "connections", + Ctx: "mysql.connections", + Priority: prioConnections, + Dims: module.Dims{ + {ID: "connections", Name: "all", Algo: module.Incremental}, + {ID: "aborted_connects", Name: "aborted", Algo: module.Incremental}, + }, + } + chartActiveConnections = module.Chart{ + ID: "connections_active", + Title: "Active Connections", + Units: "connections", + Fam: "connections", + Ctx: "mysql.connections_active", + Priority: prioActiveConnections, + Dims: module.Dims{ + {ID: "threads_connected", Name: "active"}, + {ID: "max_connections", Name: "limit"}, + {ID: "max_used_connections", Name: "max active"}, + }, + } + chartThreads = module.Chart{ + ID: "threads", + Title: "Threads", + Units: "threads", + Fam: "threads", + Ctx: "mysql.threads", + Priority: prioThreads, + Dims: module.Dims{ + {ID: "threads_connected", Name: "connected"}, + {ID: "threads_cached", Name: "cached", Mul: -1}, + {ID: "threads_running", Name: "running"}, + }, + } + chartThreadCreationRate = module.Chart{ + ID: "threads_creation_rate", + Title: "Threads Creation Rate", + Units: "threads/s", + Fam: "threads", + Ctx: "mysql.threads_created", + Priority: prioThreadsCreated, + Dims: module.Dims{ + {ID: "threads_created", Name: "created", Algo: module.Incremental}, + }, + } + chartThreadsCacheMisses = module.Chart{ + ID: "thread_cache_misses", + Title: "Threads Cache Misses", + Units: "misses", + Fam: "threads", + Ctx: "mysql.thread_cache_misses", + Type: module.Area, + Priority: prioThreadCacheMisses, + Dims: module.Dims{ + {ID: "thread_cache_misses", Name: "misses", Div: 100}, + }, + } + chartInnoDBIO = module.Chart{ + ID: "innodb_io", + Title: "InnoDB I/O Bandwidth", + Units: "KiB/s", + Fam: "innodb", + Ctx: "mysql.innodb_io", + Type: module.Area, + Priority: prioInnoDBIO, + Dims: module.Dims{ + {ID: "innodb_data_read", Name: "read", Algo: module.Incremental, Div: 1024}, + {ID: "innodb_data_written", Name: "write", Algo: module.Incremental, Div: 1024}, + }, + } + chartInnoDBIOOperations = module.Chart{ + ID: "innodb_io_ops", + Title: "InnoDB I/O Operations", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_io_ops", + Priority: prioInnoDBIOOperations, + Dims: module.Dims{ + {ID: "innodb_data_reads", Name: "reads", Algo: module.Incremental}, + {ID: "innodb_data_writes", Name: "writes", Algo: module.Incremental, Mul: -1}, + {ID: "innodb_data_fsyncs", Name: "fsyncs", Algo: module.Incremental}, + }, + } + chartInnoDBPendingIOOperations = module.Chart{ + ID: "innodb_io_pending_ops", + Title: "InnoDB Pending I/O Operations", + Units: "operations", + Fam: "innodb", + Ctx: "mysql.innodb_io_pending_ops", + Priority: prioInnoDBIOPendingOperations, + Dims: module.Dims{ + {ID: "innodb_data_pending_reads", Name: "reads"}, + {ID: "innodb_data_pending_writes", Name: "writes", Mul: -1}, + {ID: "innodb_data_pending_fsyncs", Name: "fsyncs"}, + }, + } + chartInnoDBLogOperations = module.Chart{ + ID: "innodb_log", + Title: "InnoDB Log Operations", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_log", + Priority: prioInnoDBLog, + Dims: module.Dims{ + {ID: "innodb_log_waits", Name: "waits", Algo: module.Incremental}, + {ID: "innodb_log_write_requests", Name: "write requests", Algo: module.Incremental, Mul: -1}, + {ID: "innodb_log_writes", Name: "writes", Algo: module.Incremental, Mul: -1}, + }, + } + chartInnoDBCurrentRowLocks = module.Chart{ + ID: "innodb_cur_row_lock", + Title: "InnoDB Current Row Locks", + Units: "operations", + Fam: "innodb", + Ctx: "mysql.innodb_cur_row_lock", + Type: module.Area, + Priority: prioInnoDBCurRowLock, + Dims: module.Dims{ + {ID: "innodb_row_lock_current_waits", Name: "current waits"}, + }, + } + chartInnoDBRowsOperations = module.Chart{ + ID: "innodb_rows", + Title: "InnoDB Row Operations", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_rows", + Type: module.Area, + Priority: prioInnoDBRows, + Dims: module.Dims{ + {ID: "innodb_rows_inserted", Name: "inserted", Algo: module.Incremental}, + {ID: "innodb_rows_read", Name: "read", Algo: module.Incremental}, + {ID: "innodb_rows_updated", Name: "updated", Algo: module.Incremental}, + {ID: "innodb_rows_deleted", Name: "deleted", Algo: module.Incremental, Mul: -1}, + }, + } + chartInnoDBBufferPoolPages = module.Chart{ + ID: "innodb_buffer_pool_pages", + Title: "InnoDB Buffer Pool Pages", + Units: "pages", + Fam: "innodb", + Ctx: "mysql.innodb_buffer_pool_pages", + Priority: prioInnoDBBufferPoolPages, + Dims: module.Dims{ + {ID: "innodb_buffer_pool_pages_data", Name: "data"}, + {ID: "innodb_buffer_pool_pages_dirty", Name: "dirty", Mul: -1}, + {ID: "innodb_buffer_pool_pages_free", Name: "free"}, + {ID: "innodb_buffer_pool_pages_misc", Name: "misc", Mul: -1}, + {ID: "innodb_buffer_pool_pages_total", Name: "total"}, + }, + } + chartInnoDBBufferPoolPagesFlushed = module.Chart{ + ID: "innodb_buffer_pool_flush_pages_requests", + Title: "InnoDB Buffer Pool Flush Pages Requests", + Units: "requests/s", + Fam: "innodb", + Ctx: "mysql.innodb_buffer_pool_pages_flushed", + Priority: prioInnoDBBufferPoolPagesFlushed, + Dims: module.Dims{ + {ID: "innodb_buffer_pool_pages_flushed", Name: "flush pages", Algo: module.Incremental}, + }, + } + chartInnoDBBufferPoolBytes = module.Chart{ + ID: "innodb_buffer_pool_bytes", + Title: "InnoDB Buffer Pool Bytes", + Units: "MiB", + Fam: "innodb", + Ctx: "mysql.innodb_buffer_pool_bytes", + Type: module.Area, + Priority: prioInnoDBBufferPoolBytes, + Dims: module.Dims{ + {ID: "innodb_buffer_pool_bytes_data", Name: "data", Div: 1024 * 1024}, + {ID: "innodb_buffer_pool_bytes_dirty", Name: "dirty", Mul: -1, Div: 1024 * 1024}, + }, + } + chartInnoDBBufferPoolReadAhead = module.Chart{ + ID: "innodb_buffer_pool_read_ahead", + Title: "InnoDB Buffer Pool Read Pages", + Units: "pages/s", + Fam: "innodb", + Ctx: "mysql.innodb_buffer_pool_read_ahead", + Type: module.Area, + Priority: prioInnoDBBufferPoolReadAhead, + Dims: module.Dims{ + {ID: "innodb_buffer_pool_read_ahead", Name: "all", Algo: module.Incremental}, + {ID: "innodb_buffer_pool_read_ahead_evicted", Name: "evicted", Algo: module.Incremental, Mul: -1}, + }, + } + chartInnoDBBufferPoolReadAheadRnd = module.Chart{ + ID: "innodb_buffer_pool_read_ahead_rnd", + Title: "InnoDB Buffer Pool Random Read-Aheads", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_buffer_pool_read_ahead_rnd", + Priority: prioInnoDBBufferPoolReadAheadRnd, + Dims: module.Dims{ + {ID: "innodb_buffer_pool_read_ahead_rnd", Name: "read-ahead", Algo: module.Incremental}, + }, + } + chartInnoDBBufferPoolOperations = module.Chart{ + ID: "innodb_buffer_pool_ops", + Title: "InnoDB Buffer Pool Operations", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_buffer_pool_ops", + Type: module.Area, + Priority: prioInnoDBBufferPoolOperations, + Dims: module.Dims{ + {ID: "innodb_buffer_pool_reads", Name: "disk reads", Algo: module.Incremental}, + {ID: "innodb_buffer_pool_wait_free", Name: "wait free", Algo: module.Incremental, Mul: -1, Div: 1}, + }, + } + chartOpenFiles = module.Chart{ + ID: "files", + Title: "Open Files", + Units: "files", + Fam: "files", + Ctx: "mysql.files", + Priority: prioOpenFiles, + Dims: module.Dims{ + {ID: "open_files", Name: "files"}, + }, + } + chartOpenedFilesRate = module.Chart{ + ID: "files_rate", + Title: "Opened Files Rate", + Units: "files/s", + Fam: "files", + Ctx: "mysql.files_rate", + Priority: prioOpenFilesRate, + Dims: module.Dims{ + {ID: "opened_files", Name: "files", Algo: module.Incremental}, + }, + } + chartConnectionErrors = module.Chart{ + ID: "connection_errors", + Title: "Connection Errors", + Units: "errors/s", + Fam: "connections", + Ctx: "mysql.connection_errors", + Priority: prioConnectionErrors, + Dims: module.Dims{ + {ID: "connection_errors_accept", Name: "accept", Algo: module.Incremental}, + {ID: "connection_errors_internal", Name: "internal", Algo: module.Incremental}, + {ID: "connection_errors_max_connections", Name: "max", Algo: module.Incremental}, + {ID: "connection_errors_peer_address", Name: "peer addr", Algo: module.Incremental}, + {ID: "connection_errors_select", Name: "select", Algo: module.Incremental}, + {ID: "connection_errors_tcpwrap", Name: "tcpwrap", Algo: module.Incremental}, + }, + } + chartOpenedTables = module.Chart{ + ID: "opened_tables", + Title: "Opened Tables", + Units: "tables/s", + Fam: "open tables", + Ctx: "mysql.opened_tables", + Priority: prioOpenedTables, + Dims: module.Dims{ + {ID: "opened_tables", Name: "tables", Algo: module.Incremental}, + }, + } + chartOpenTables = module.Chart{ + ID: "open_tables", + Title: "Open Tables", + Units: "tables", + Fam: "open tables", + Ctx: "mysql.open_tables", + Type: module.Area, + Priority: prioOpenTables, + Dims: module.Dims{ + {ID: "table_open_cache", Name: "cache"}, + {ID: "open_tables", Name: "tables"}, + }, + } + chartProcessListFetchQueryDuration = module.Chart{ + ID: "process_list_fetch_duration", + Title: "Process List Fetch Duration", + Units: "milliseconds", + Fam: "process list", + Ctx: "mysql.process_list_fetch_query_duration", + Priority: prioProcessListFetchQueryDuration, + Dims: module.Dims{ + {ID: "process_list_fetch_query_duration", Name: "duration"}, + }, + } + chartProcessListQueries = module.Chart{ + ID: "process_list_queries_count", + Title: "Queries Count", + Units: "queries", + Fam: "process list", + Ctx: "mysql.process_list_queries_count", + Type: module.Stacked, + Priority: prioProcessListQueries, + Dims: module.Dims{ + {ID: "process_list_queries_count_system", Name: "system"}, + {ID: "process_list_queries_count_user", Name: "user"}, + }, + } + chartProcessListLongestQueryDuration = module.Chart{ + ID: "process_list_longest_query_duration", + Title: "Longest Query Duration", + Units: "seconds", + Fam: "process list", + Ctx: "mysql.process_list_longest_query_duration", + Priority: prioProcessListLongestQueryDuration, + Dims: module.Dims{ + {ID: "process_list_longest_query_duration", Name: "duration"}, + }, + } +) + +var chartsInnoDBOSLog = module.Charts{ + chartInnoDBOSLogPendingOperations.Copy(), + chartInnoDBOSLogOperations.Copy(), + chartInnoDBOSLogIO.Copy(), +} + +var ( + chartInnoDBOSLogPendingOperations = module.Chart{ + ID: "innodb_os_log", + Title: "InnoDB OS Log Pending Operations", + Units: "operations", + Fam: "innodb", + Ctx: "mysql.innodb_os_log", + Priority: prioInnoDBOSLog, + Dims: module.Dims{ + {ID: "innodb_os_log_pending_fsyncs", Name: "fsyncs"}, + {ID: "innodb_os_log_pending_writes", Name: "writes", Mul: -1}, + }, + } + chartInnoDBOSLogOperations = module.Chart{ + ID: "innodb_os_log_fsync_writes", + Title: "InnoDB OS Log Operations", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_os_log_fsync_writes", + Priority: prioInnoDBOSLogFsyncWrites, + Dims: module.Dims{ + {ID: "innodb_os_log_fsyncs", Name: "fsyncs", Algo: module.Incremental}, + }, + } + chartInnoDBOSLogIO = module.Chart{ + ID: "innodb_os_log_io", + Title: "InnoDB OS Log Bandwidth", + Units: "KiB/s", + Fam: "innodb", + Ctx: "mysql.innodb_os_log_io", + Type: module.Area, + Priority: prioInnoDBOSLogIO, + Dims: module.Dims{ + {ID: "innodb_os_log_written", Name: "write", Algo: module.Incremental, Mul: -1, Div: 1024}, + }, + } +) + +var chartInnoDBDeadlocks = module.Chart{ + ID: "innodb_deadlocks", + Title: "InnoDB Deadlocks", + Units: "operations/s", + Fam: "innodb", + Ctx: "mysql.innodb_deadlocks", + Type: module.Area, + Priority: prioInnoDBDeadlocks, + Dims: module.Dims{ + {ID: "innodb_deadlocks", Name: "deadlocks", Algo: module.Incremental}, + }, +} + +var chartsQCache = module.Charts{ + chartQCacheOperations.Copy(), + chartQCacheQueries.Copy(), + chartQCacheFreeMemory.Copy(), + chartQCacheMemoryBlocks.Copy(), +} + +var ( + chartQCacheOperations = module.Chart{ + ID: "qcache_ops", + Title: "QCache Operations", + Units: "queries/s", + Fam: "qcache", + Ctx: "mysql.qcache_ops", + Priority: prioQCacheOperations, + Dims: module.Dims{ + {ID: "qcache_hits", Name: "hits", Algo: module.Incremental}, + {ID: "qcache_lowmem_prunes", Name: "lowmem prunes", Algo: module.Incremental, Mul: -1}, + {ID: "qcache_inserts", Name: "inserts", Algo: module.Incremental}, + {ID: "qcache_not_cached", Name: "not cached", Algo: module.Incremental, Mul: -1}, + }, + } + chartQCacheQueries = module.Chart{ + ID: "qcache", + Title: "QCache Queries in Cache", + Units: "queries", + Fam: "qcache", + Ctx: "mysql.qcache", + Priority: prioQCacheQueries, + Dims: module.Dims{ + {ID: "qcache_queries_in_cache", Name: "queries", Algo: module.Absolute}, + }, + } + chartQCacheFreeMemory = module.Chart{ + ID: "qcache_freemem", + Title: "QCache Free Memory", + Units: "MiB", + Fam: "qcache", + Ctx: "mysql.qcache_freemem", + Type: module.Area, + Priority: prioQCacheFreeMem, + Dims: module.Dims{ + {ID: "qcache_free_memory", Name: "free", Div: 1024 * 1024}, + }, + } + chartQCacheMemoryBlocks = module.Chart{ + ID: "qcache_memblocks", + Title: "QCache Memory Blocks", + Units: "blocks", + Fam: "qcache", + Ctx: "mysql.qcache_memblocks", + Priority: prioQCacheMemBlocks, + Dims: module.Dims{ + {ID: "qcache_free_blocks", Name: "free"}, + {ID: "qcache_total_blocks", Name: "total"}, + }, + } +) + +var chartsGalera = module.Charts{ + chartGaleraWriteSets.Copy(), + chartGaleraBytes.Copy(), + chartGaleraQueue.Copy(), + chartGaleraConflicts.Copy(), + chartGaleraFlowControl.Copy(), + chartGaleraClusterStatus.Copy(), + chartGaleraClusterState.Copy(), + chartGaleraClusterSize.Copy(), + chartGaleraClusterWeight.Copy(), + chartGaleraClusterConnectionStatus.Copy(), + chartGaleraReadinessState.Copy(), + chartGaleraOpenTransactions.Copy(), + chartGaleraThreads.Copy(), +} +var ( + chartGaleraWriteSets = module.Chart{ + ID: "galera_writesets", + Title: "Replicated Writesets", + Units: "writesets/s", + Fam: "galera", + Ctx: "mysql.galera_writesets", + Priority: prioGaleraWriteSets, + Dims: module.Dims{ + {ID: "wsrep_received", Name: "rx", Algo: module.Incremental}, + {ID: "wsrep_replicated", Name: "tx", Algo: module.Incremental, Mul: -1}, + }, + } + chartGaleraBytes = module.Chart{ + ID: "galera_bytes", + Title: "Replicated Bytes", + Units: "KiB/s", + Fam: "galera", + Ctx: "mysql.galera_bytes", + Type: module.Area, + Priority: prioGaleraBytes, + Dims: module.Dims{ + {ID: "wsrep_received_bytes", Name: "rx", Algo: module.Incremental, Div: 1024}, + {ID: "wsrep_replicated_bytes", Name: "tx", Algo: module.Incremental, Mul: -1, Div: 1024}, + }, + } + chartGaleraQueue = module.Chart{ + ID: "galera_queue", + Title: "Galera Queue", + Units: "writesets", + Fam: "galera", + Ctx: "mysql.galera_queue", + Priority: prioGaleraQueue, + Dims: module.Dims{ + {ID: "wsrep_local_recv_queue", Name: "rx"}, + {ID: "wsrep_local_send_queue", Name: "tx", Mul: -1}, + }, + } + chartGaleraConflicts = module.Chart{ + ID: "galera_conflicts", + Title: "Replication Conflicts", + Units: "transactions", + Fam: "galera", + Ctx: "mysql.galera_conflicts", + Type: module.Area, + Priority: prioGaleraConflicts, + Dims: module.Dims{ + {ID: "wsrep_local_bf_aborts", Name: "bf aborts", Algo: module.Incremental}, + {ID: "wsrep_local_cert_failures", Name: "cert fails", Algo: module.Incremental, Mul: -1}, + }, + } + chartGaleraFlowControl = module.Chart{ + ID: "galera_flow_control", + Title: "Flow Control", + Units: "ms", + Fam: "galera", + Ctx: "mysql.galera_flow_control", + Type: module.Area, + Priority: prioGaleraFlowControl, + Dims: module.Dims{ + {ID: "wsrep_flow_control_paused_ns", Name: "paused", Algo: module.Incremental, Div: 1000000}, + }, + } + chartGaleraClusterStatus = module.Chart{ + ID: "galera_cluster_status", + Title: "Cluster Component Status", + Units: "status", + Fam: "galera", + Ctx: "mysql.galera_cluster_status", + Priority: prioGaleraClusterStatus, + Dims: module.Dims{ + {ID: "wsrep_cluster_status_primary", Name: "primary"}, + {ID: "wsrep_cluster_status_non_primary", Name: "non_primary"}, + {ID: "wsrep_cluster_status_disconnected", Name: "disconnected"}, + }, + } + chartGaleraClusterState = module.Chart{ + ID: "galera_cluster_state", + Title: "Cluster Component State", + Units: "state", + Fam: "galera", + Ctx: "mysql.galera_cluster_state", + Priority: prioGaleraClusterState, + Dims: module.Dims{ + {ID: "wsrep_local_state_undefined", Name: "undefined"}, + {ID: "wsrep_local_state_joiner", Name: "joining"}, + {ID: "wsrep_local_state_donor", Name: "donor"}, + {ID: "wsrep_local_state_joined", Name: "joined"}, + {ID: "wsrep_local_state_synced", Name: "synced"}, + {ID: "wsrep_local_state_error", Name: "error"}, + }, + } + chartGaleraClusterSize = module.Chart{ + ID: "galera_cluster_size", + Title: "Number of Nodes in the Cluster", + Units: "nodes", + Fam: "galera", + Ctx: "mysql.galera_cluster_size", + Priority: prioGaleraClusterSize, + Dims: module.Dims{ + {ID: "wsrep_cluster_size", Name: "nodes"}, + }, + } + chartGaleraClusterWeight = module.Chart{ + ID: "galera_cluster_weight", + Title: "The Total Weight of the Current Members in the Cluster", + Units: "weight", + Fam: "galera", + Ctx: "mysql.galera_cluster_weight", + Priority: prioGaleraClusterWeight, + Dims: module.Dims{ + {ID: "wsrep_cluster_weight", Name: "weight"}, + }, + } + chartGaleraClusterConnectionStatus = module.Chart{ + ID: "galera_connected", + Title: "Cluster Connection Status", + Units: "boolean", + Fam: "galera", + Ctx: "mysql.galera_connected", + Priority: prioGaleraClusterConnectionStatus, + Dims: module.Dims{ + {ID: "wsrep_connected", Name: "connected"}, + }, + } + chartGaleraReadinessState = module.Chart{ + ID: "galera_ready", + Title: "Accept Queries Readiness Status", + Units: "boolean", + Fam: "galera", + Ctx: "mysql.galera_ready", + Priority: prioGaleraReadinessState, + Dims: module.Dims{ + {ID: "wsrep_ready", Name: "ready"}, + }, + } + chartGaleraOpenTransactions = module.Chart{ + ID: "galera_open_transactions", + Title: "Open Transactions", + Units: "transactions", + Fam: "galera", + Ctx: "mysql.galera_open_transactions", + Priority: prioGaleraOpenTransactions, + Dims: module.Dims{ + {ID: "wsrep_open_transactions", Name: "open"}, + }, + } + chartGaleraThreads = module.Chart{ + ID: "galera_thread_count", + Title: "Total Number of WSRep (applier/rollbacker) Threads", + Units: "threads", + Fam: "galera", + Ctx: "mysql.galera_thread_count", + Priority: prioGaleraThreadCount, + Dims: module.Dims{ + {ID: "wsrep_thread_count", Name: "threads"}, + }, + } +) + +var chartsMyISAM = module.Charts{ + chartMyISAMKeyCacheBlocks.Copy(), + chartMyISAMKeyCacheRequests.Copy(), + chartMyISAMKeyCacheDiskOperations.Copy(), +} +var ( + chartMyISAMKeyCacheBlocks = module.Chart{ + ID: "key_blocks", + Title: "MyISAM Key Cache Blocks", + Units: "blocks", + Fam: "myisam", + Ctx: "mysql.key_blocks", + Priority: prioMyISAMKeyBlocks, + Dims: module.Dims{ + {ID: "key_blocks_unused", Name: "unused"}, + {ID: "key_blocks_used", Name: "used", Mul: -1}, + {ID: "key_blocks_not_flushed", Name: "not flushed"}, + }, + } + chartMyISAMKeyCacheRequests = module.Chart{ + ID: "key_requests", + Title: "MyISAM Key Cache Requests", + Units: "requests/s", + Fam: "myisam", + Ctx: "mysql.key_requests", + Type: module.Area, + Priority: prioMyISAMKeyRequests, + Dims: module.Dims{ + {ID: "key_read_requests", Name: "reads", Algo: module.Incremental}, + {ID: "key_write_requests", Name: "writes", Algo: module.Incremental, Mul: -1}, + }, + } + chartMyISAMKeyCacheDiskOperations = module.Chart{ + ID: "key_disk_ops", + Title: "MyISAM Key Cache Disk Operations", + Units: "operations/s", + Fam: "myisam", + Ctx: "mysql.key_disk_ops", + Priority: prioMyISAMKeyDiskOperations, + Type: module.Area, + Dims: module.Dims{ + {ID: "key_reads", Name: "reads", Algo: module.Incremental}, + {ID: "key_writes", Name: "writes", Algo: module.Incremental, Mul: -1}, + }, + } +) + +var chartsBinlog = module.Charts{ + chartBinlogCache.Copy(), + chartBinlogStatementCache.Copy(), +} + +var ( + chartBinlogCache = module.Chart{ + ID: "binlog_cache", + Title: "Binlog Cache", + Units: "transactions/s", + Fam: "binlog", + Ctx: "mysql.binlog_cache", + Priority: prioBinlogCache, + Dims: module.Dims{ + {ID: "binlog_cache_disk_use", Name: "disk", Algo: module.Incremental}, + {ID: "binlog_cache_use", Name: "all", Algo: module.Incremental}, + }, + } + chartBinlogStatementCache = module.Chart{ + ID: "binlog_stmt_cache", + Title: "Binlog Statement Cache", + Units: "statements/s", + Fam: "binlog", + Ctx: "mysql.binlog_stmt_cache", + Priority: prioBinlogStatementCache, + Dims: module.Dims{ + {ID: "binlog_stmt_cache_disk_use", Name: "disk", Algo: module.Incremental}, + {ID: "binlog_stmt_cache_use", Name: "all", Algo: module.Incremental}, + }, + } +) + +var ( + chartsSlaveReplication = module.Charts{ + chartSlaveBehindSeconds.Copy(), + chartSlaveSQLIOThreadRunningState.Copy(), + } + + chartSlaveBehindSeconds = module.Chart{ + ID: "slave_behind", + Title: "Slave Behind Seconds", + Units: "seconds", + Fam: "slave", + Ctx: "mysql.slave_behind", + Priority: prioSlaveSecondsBehindMaster, + Dims: module.Dims{ + {ID: "seconds_behind_master", Name: "seconds"}, + }, + } + chartSlaveSQLIOThreadRunningState = module.Chart{ + ID: "slave_thread_running", + Title: "I/O / SQL Thread Running State", + Units: "boolean", + Fam: "slave", + Ctx: "mysql.slave_status", + Priority: prioSlaveSQLIOThreadRunningState, + Dims: module.Dims{ + {ID: "slave_sql_running", Name: "sql_running"}, + {ID: "slave_io_running", Name: "io_running"}, + }, + } +) + +func newSlaveReplConnCharts(conn string) *module.Charts { + orig := conn + conn = strings.ToLower(conn) + cs := chartsSlaveReplication.Copy() + for _, chart := range *cs { + chart.ID += "_" + conn + chart.Title += " Connection " + orig + for _, dim := range chart.Dims { + dim.ID += "_" + conn + } + } + return cs +} + +func newMariaDBUserStatisticsCharts(user string) *module.Charts { + lcUser := strings.ToLower(user) + charts := chartsTmplUserStats.Copy() + for _, c := range *charts { + c.ID = fmt.Sprintf(c.ID, lcUser) + c.Labels = []module.Label{ + {Key: "user", Value: user}, + } + for _, d := range c.Dims { + d.ID = fmt.Sprintf(d.ID, lcUser) + } + } + return charts +} + +func newPerconaUserStatisticsCharts(user string) *module.Charts { + lcUser := strings.ToLower(user) + charts := chartsTmplPerconaUserStats.Copy() + for _, c := range *charts { + c.ID = fmt.Sprintf(c.ID, lcUser) + c.Labels = []module.Label{ + {Key: "user", Value: user}, + } + for _, d := range c.Dims { + d.ID = fmt.Sprintf(d.ID, lcUser) + } + } + return charts +} + +var ( + chartsTmplUserStats = module.Charts{ + chartUserStatsCPU.Copy(), + chartTmplUserStatsRowsOperations.Copy(), + chartTmplUserStatsCommands.Copy(), + chartTmplUserStatsDeniedCommands.Copy(), + chartTmplUserStatsTransactions.Copy(), + chartTmplUserStatsBinlogWritten.Copy(), + chartTmplUserStatsEmptyQueries.Copy(), + chartTmplUserStatsCreatedConnections.Copy(), + chartTmplUserStatsLostConnections.Copy(), + chartTmplUserStatsDeniedConnections.Copy(), + } + chartsTmplPerconaUserStats = module.Charts{ + chartUserStatsCPU.Copy(), + chartTmplPerconaUserStatsRowsOperations.Copy(), + chartTmplUserStatsCommands.Copy(), + chartTmplUserStatsDeniedCommands.Copy(), + chartTmplUserStatsTransactions.Copy(), + chartTmplUserStatsBinlogWritten.Copy(), + chartTmplUserStatsEmptyQueries.Copy(), + chartTmplUserStatsCreatedConnections.Copy(), + chartTmplUserStatsLostConnections.Copy(), + chartTmplUserStatsDeniedConnections.Copy(), + } + + chartUserStatsCPU = module.Chart{ + ID: "userstats_cpu_%s", + Title: "User CPU Time", + Units: "percentage", + Fam: "user cpu time", + Ctx: "mysql.userstats_cpu", + Priority: prioUserStatsCPUTime, + Dims: module.Dims{ + {ID: "userstats_%s_cpu_time", Name: "used", Mul: 100, Div: 1000, Algo: module.Incremental}, + }, + } + chartTmplUserStatsRowsOperations = module.Chart{ + ID: "userstats_rows_%s", + Title: "User Rows Operations", + Units: "operations/s", + Fam: "user operations", + Ctx: "mysql.userstats_rows", + Type: module.Stacked, + Priority: prioUserStatsRows, + Dims: module.Dims{ + {ID: "userstats_%s_rows_read", Name: "read", Algo: module.Incremental}, + {ID: "userstats_%s_rows_sent", Name: "sent", Algo: module.Incremental}, + {ID: "userstats_%s_rows_updated", Name: "updated", Algo: module.Incremental}, + {ID: "userstats_%s_rows_inserted", Name: "inserted", Algo: module.Incremental}, + {ID: "userstats_%s_rows_deleted", Name: "deleted", Algo: module.Incremental}, + }, + } + chartTmplPerconaUserStatsRowsOperations = module.Chart{ + ID: "userstats_rows_%s", + Title: "User Rows Operations", + Units: "operations/s", + Fam: "user operations", + Ctx: "mysql.userstats_rows", + Type: module.Stacked, + Priority: prioUserStatsRows, + Dims: module.Dims{ + {ID: "userstats_%s_rows_fetched", Name: "fetched", Algo: module.Incremental}, + {ID: "userstats_%s_rows_updated", Name: "updated", Algo: module.Incremental}, + }, + } + chartTmplUserStatsCommands = module.Chart{ + ID: "userstats_commands_%s", + Title: "User Commands", + Units: "commands/s", + Fam: "user commands", + Ctx: "mysql.userstats_commands", + Type: module.Stacked, + Priority: prioUserStatsCommands, + Dims: module.Dims{ + {ID: "userstats_%s_select_commands", Name: "select", Algo: module.Incremental}, + {ID: "userstats_%s_update_commands", Name: "update", Algo: module.Incremental}, + {ID: "userstats_%s_other_commands", Name: "other", Algo: module.Incremental}, + }, + } + chartTmplUserStatsDeniedCommands = module.Chart{ + ID: "userstats_denied_commands_%s", + Title: "User Denied Commands", + Units: "commands/s", + Fam: "user commands denied", + Ctx: "mysql.userstats_denied_commands", + Priority: prioUserStatsDeniedCommands, + Dims: module.Dims{ + {ID: "userstats_%s_access_denied", Name: "denied", Algo: module.Incremental}, + }, + } + chartTmplUserStatsTransactions = module.Chart{ + ID: "userstats_transactions_%s", + Title: "User Transactions", + Units: "transactions/s", + Fam: "user transactions", + Ctx: "mysql.userstats_created_transactions", + Type: module.Area, + Priority: prioUserStatsTransactions, + Dims: module.Dims{ + {ID: "userstats_%s_commit_transactions", Name: "commit", Algo: module.Incremental}, + {ID: "userstats_%s_rollback_transactions", Name: "rollback", Algo: module.Incremental}, + }, + } + chartTmplUserStatsBinlogWritten = module.Chart{ + ID: "userstats_binlog_written_%s", + Title: "User Binlog Written", + Units: "B/s", + Fam: "user binlog written", + Ctx: "mysql.userstats_binlog_written", + Priority: prioUserStatsBinlogWritten, + Dims: module.Dims{ + {ID: "userstats_%s_binlog_bytes_written", Name: "written", Algo: module.Incremental}, + }, + } + chartTmplUserStatsEmptyQueries = module.Chart{ + ID: "userstats_empty_queries_%s", + Title: "User Empty Queries", + Units: "queries/s", + Fam: "user empty queries", + Ctx: "mysql.userstats_empty_queries", + Priority: prioUserStatsEmptyQueries, + Dims: module.Dims{ + {ID: "userstats_%s_empty_queries", Name: "empty", Algo: module.Incremental}, + }, + } + chartTmplUserStatsCreatedConnections = module.Chart{ + ID: "userstats_connections_%s", + Title: "User Created Connections", + Units: "connections/s", + Fam: "user connections created ", + Ctx: "mysql.userstats_connections", + Priority: prioUserStatsConnections, + Dims: module.Dims{ + {ID: "userstats_%s_total_connections", Name: "created", Algo: module.Incremental}, + }, + } + chartTmplUserStatsLostConnections = module.Chart{ + ID: "userstats_lost_connections_%s", + Title: "User Lost Connections", + Units: "connections/s", + Fam: "user connections lost", + Ctx: "mysql.userstats_lost_connections", + Priority: prioUserStatsLostConnections, + Dims: module.Dims{ + {ID: "userstats_%s_lost_connections", Name: "lost", Algo: module.Incremental}, + }, + } + chartTmplUserStatsDeniedConnections = module.Chart{ + ID: "userstats_denied_connections_%s", + Title: "User Denied Connections", + Units: "connections/s", + Fam: "user connections denied", + Ctx: "mysql.userstats_denied_connections", + Priority: prioUserStatsDeniedConnections, + Dims: module.Dims{ + {ID: "userstats_%s_denied_connections", Name: "denied", Algo: module.Incremental}, + }, + } +) + +func (m *MySQL) addSlaveReplicationConnCharts(conn string) { + var charts *module.Charts + if conn == "" { + charts = chartsSlaveReplication.Copy() + } else { + charts = newSlaveReplConnCharts(conn) + } + if err := m.Charts().Add(*charts...); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addUserStatisticsCharts(user string) { + if m.isPercona { + if err := m.Charts().Add(*newPerconaUserStatisticsCharts(user)...); err != nil { + m.Warning(err) + } + } else { + if err := m.Charts().Add(*newMariaDBUserStatisticsCharts(user)...); err != nil { + m.Warning(err) + } + } +} + +func (m *MySQL) addInnoDBOSLogCharts() { + if err := m.Charts().Add(*chartsInnoDBOSLog.Copy()...); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addMyISAMCharts() { + if err := m.Charts().Add(*chartsMyISAM.Copy()...); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addBinlogCharts() { + if err := m.Charts().Add(*chartsBinlog.Copy()...); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addInnodbDeadlocksChart() { + if err := m.Charts().Add(chartInnoDBDeadlocks.Copy()); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addQCacheCharts() { + if err := m.Charts().Add(*chartsQCache.Copy()...); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addGaleraCharts() { + if err := m.Charts().Add(*chartsGalera.Copy()...); err != nil { + m.Warning(err) + } +} + +func (m *MySQL) addTableOpenCacheOverflowChart() { + if err := m.Charts().Add(chartTableOpenCacheOverflows.Copy()); err != nil { + m.Warning(err) + } +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect.go b/src/go/collectors/go.d.plugin/modules/mysql/collect.go new file mode 100644 index 000000000..5f28cd139 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect.go @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "context" + "database/sql" + "errors" + "fmt" + "strconv" + "strings" + "time" + + "github.com/blang/semver/v4" +) + +func (m *MySQL) collect() (map[string]int64, error) { + if m.db == nil { + if err := m.openConnection(); err != nil { + return nil, err + } + } + if m.version == nil { + if err := m.collectVersion(); err != nil { + return nil, fmt.Errorf("error on collecting version: %v", err) + } + // https://mariadb.com/kb/en/user-statistics/ + m.doUserStatistics = m.isPercona || m.isMariaDB && m.version.GTE(semver.Version{Major: 10, Minor: 1, Patch: 1}) + } + + m.disableSessionQueryLog() + + mx := make(map[string]int64) + + if err := m.collectGlobalStatus(mx); err != nil { + return nil, fmt.Errorf("error on collecting global status: %v", err) + } + + if hasInnodbOSLog(mx) { + m.addInnoDBOSLogOnce.Do(m.addInnoDBOSLogCharts) + } + if hasInnodbDeadlocks(mx) { + m.addInnodbDeadlocksOnce.Do(m.addInnodbDeadlocksChart) + } + if hasQCacheMetrics(mx) { + m.addQCacheOnce.Do(m.addQCacheCharts) + } + if hasGaleraMetrics(mx) { + m.addGaleraOnce.Do(m.addGaleraCharts) + } + if hasTableOpenCacheOverflowsMetrics(mx) { + m.addTableOpenCacheOverflowsOnce.Do(m.addTableOpenCacheOverflowChart) + } + + now := time.Now() + if now.Sub(m.recheckGlobalVarsTime) > m.recheckGlobalVarsEvery { + if err := m.collectGlobalVariables(); err != nil { + return nil, fmt.Errorf("error on collecting global variables: %v", err) + } + } + mx["max_connections"] = m.varMaxConns + mx["table_open_cache"] = m.varTableOpenCache + + if m.isMariaDB || !strings.Contains(m.varDisabledStorageEngine, "MyISAM") { + m.addMyISAMOnce.Do(m.addMyISAMCharts) + } + if m.varLogBin != "OFF" { + m.addBinlogOnce.Do(m.addBinlogCharts) + } + + // TODO: perhaps make a decisions based on privileges? (SHOW GRANTS FOR CURRENT_USER();) + if m.doSlaveStatus { + if err := m.collectSlaveStatus(mx); err != nil { + m.Warningf("error on collecting slave status: %v", err) + m.doSlaveStatus = errors.Is(err, context.DeadlineExceeded) + } + } + + if m.doUserStatistics { + if err := m.collectUserStatistics(mx); err != nil { + m.Warningf("error on collecting user statistics: %v", err) + m.doUserStatistics = errors.Is(err, context.DeadlineExceeded) + } + } + + if err := m.collectProcessListStatistics(mx); err != nil { + m.Errorf("error on collecting process list statistics: %v", err) + } + + calcThreadCacheMisses(mx) + return mx, nil +} + +func (m *MySQL) openConnection() error { + db, err := sql.Open("mysql", m.DSN) + if err != nil { + return fmt.Errorf("error on opening a connection with the mysql database [%s]: %v", m.safeDSN, err) + } + + db.SetConnMaxLifetime(10 * time.Minute) + + ctx, cancel := context.WithTimeout(context.Background(), m.Timeout.Duration()) + defer cancel() + + if err := db.PingContext(ctx); err != nil { + _ = db.Close() + return fmt.Errorf("error on pinging the mysql database [%s]: %v", m.safeDSN, err) + } + + m.db = db + return nil +} + +func calcThreadCacheMisses(collected map[string]int64) { + threads, cons := collected["threads_created"], collected["connections"] + if threads == 0 || cons == 0 { + collected["thread_cache_misses"] = 0 + } else { + collected["thread_cache_misses"] = int64(float64(threads) / float64(cons) * 10000) + } +} + +func hasInnodbOSLog(collected map[string]int64) bool { + // removed in MariaDB 10.8 (https://mariadb.com/kb/en/innodb-status-variables/#innodb_os_log_fsyncs) + _, ok := collected["innodb_os_log_fsyncs"] + return ok +} + +func hasInnodbDeadlocks(collected map[string]int64) bool { + _, ok := collected["innodb_deadlocks"] + return ok +} + +func hasGaleraMetrics(collected map[string]int64) bool { + _, ok := collected["wsrep_received"] + return ok +} + +func hasQCacheMetrics(collected map[string]int64) bool { + _, ok := collected["qcache_hits"] + return ok +} + +func hasTableOpenCacheOverflowsMetrics(collected map[string]int64) bool { + _, ok := collected["table_open_cache_overflows"] + return ok +} + +func (m *MySQL) collectQuery(query string, assign func(column, value string, lineEnd bool)) (duration int64, err error) { + ctx, cancel := context.WithTimeout(context.Background(), m.Timeout.Duration()) + defer cancel() + + s := time.Now() + rows, err := m.db.QueryContext(ctx, query) + if err != nil { + return 0, err + } + duration = time.Since(s).Milliseconds() + defer func() { _ = rows.Close() }() + + columns, err := rows.Columns() + if err != nil { + return duration, err + } + + vs := makeValues(len(columns)) + for rows.Next() { + if err := rows.Scan(vs...); err != nil { + return duration, err + } + for i, l := 0, len(vs); i < l; i++ { + assign(columns[i], valueToString(vs[i]), i == l-1) + } + } + return duration, rows.Err() +} + +func makeValues(size int) []any { + vs := make([]any, size) + for i := range vs { + vs[i] = &sql.NullString{} + } + return vs +} + +func valueToString(value any) string { + v, ok := value.(*sql.NullString) + if !ok || !v.Valid { + return "" + } + return v.String +} + +func parseInt(s string) int64 { + v, _ := strconv.ParseInt(s, 10, 64) + return v +} + +func parseFloat(s string) float64 { + v, _ := strconv.ParseFloat(s, 64) + return v +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect_global_status.go b/src/go/collectors/go.d.plugin/modules/mysql/collect_global_status.go new file mode 100644 index 000000000..c6dff9e93 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect_global_status.go @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "strings" +) + +const queryShowGlobalStatus = "SHOW GLOBAL STATUS;" + +func (m *MySQL) collectGlobalStatus(mx map[string]int64) error { + // MariaDB: https://mariadb.com/kb/en/server-status-variables/ + // MySQL: https://dev.mysql.com/doc/refman/8.0/en/server-status-variable-reference.html + q := queryShowGlobalStatus + m.Debugf("executing query: '%s'", q) + + var name string + _, err := m.collectQuery(q, func(column, value string, _ bool) { + switch column { + case "Variable_name": + name = value + case "Value": + if !globalStatusKeys[name] { + return + } + switch name { + case "wsrep_connected": + mx[name] = parseInt(convertWsrepConnected(value)) + case "wsrep_ready": + mx[name] = parseInt(convertWsrepReady(value)) + case "wsrep_local_state": + // https://mariadb.com/kb/en/galera-cluster-status-variables/#wsrep_local_state + // https://github.com/codership/wsrep-API/blob/eab2d5d5a31672c0b7d116ef1629ff18392fd7d0/wsrep_api.h#L256 + mx[name+"_undefined"] = boolToInt(value == "0") + mx[name+"_joiner"] = boolToInt(value == "1") + mx[name+"_donor"] = boolToInt(value == "2") + mx[name+"_joined"] = boolToInt(value == "3") + mx[name+"_synced"] = boolToInt(value == "4") + mx[name+"_error"] = boolToInt(parseInt(value) >= 5) + case "wsrep_cluster_status": + // https://www.percona.com/doc/percona-xtradb-cluster/LATEST/wsrep-status-index.html#wsrep_cluster_status + // https://github.com/codership/wsrep-API/blob/eab2d5d5a31672c0b7d116ef1629ff18392fd7d0/wsrep_api.h + // https://github.com/codership/wsrep-API/blob/f71cd270414ee70dde839cfc59c1731eea4230ea/examples/node/wsrep.c#L80 + value = strings.ToUpper(value) + mx[name+"_primary"] = boolToInt(value == "PRIMARY") + mx[name+"_non_primary"] = boolToInt(value == "NON-PRIMARY") + mx[name+"_disconnected"] = boolToInt(value == "DISCONNECTED") + default: + mx[strings.ToLower(name)] = parseInt(value) + } + } + }) + return err +} + +func convertWsrepConnected(val string) string { + // https://www.percona.com/doc/percona-xtradb-cluster/LATEST/wsrep-status-index.html#wsrep_connected + switch val { + case "OFF": + return "0" + case "ON": + return "1" + default: + return "-1" + } +} + +func convertWsrepReady(val string) string { + // https://www.percona.com/doc/percona-xtradb-cluster/LATEST/wsrep-status-index.html#wsrep_ready + switch val { + case "OFF": + return "0" + case "ON": + return "1" + default: + return "-1" + } +} + +func boolToInt(v bool) int64 { + if v { + return 1 + } + return 0 +} + +var globalStatusKeys = map[string]bool{ + "Bytes_received": true, + "Bytes_sent": true, + "Queries": true, + "Questions": true, + "Slow_queries": true, + "Handler_commit": true, + "Handler_delete": true, + "Handler_prepare": true, + "Handler_read_first": true, + "Handler_read_key": true, + "Handler_read_next": true, + "Handler_read_prev": true, + "Handler_read_rnd": true, + "Handler_read_rnd_next": true, + "Handler_rollback": true, + "Handler_savepoint": true, + "Handler_savepoint_rollback": true, + "Handler_update": true, + "Handler_write": true, + "Table_locks_immediate": true, + "Table_locks_waited": true, + "Table_open_cache_overflows": true, + "Select_full_join": true, + "Select_full_range_join": true, + "Select_range": true, + "Select_range_check": true, + "Select_scan": true, + "Sort_merge_passes": true, + "Sort_range": true, + "Sort_scan": true, + "Created_tmp_disk_tables": true, + "Created_tmp_files": true, + "Created_tmp_tables": true, + "Connections": true, + "Aborted_connects": true, + "Max_used_connections": true, + "Binlog_cache_disk_use": true, + "Binlog_cache_use": true, + "Threads_connected": true, + "Threads_created": true, + "Threads_cached": true, + "Threads_running": true, + "Thread_cache_misses": true, + "Innodb_data_read": true, + "Innodb_data_written": true, + "Innodb_data_reads": true, + "Innodb_data_writes": true, + "Innodb_data_fsyncs": true, + "Innodb_data_pending_reads": true, + "Innodb_data_pending_writes": true, + "Innodb_data_pending_fsyncs": true, + "Innodb_log_waits": true, + "Innodb_log_write_requests": true, + "Innodb_log_writes": true, + "Innodb_os_log_fsyncs": true, + "Innodb_os_log_pending_fsyncs": true, + "Innodb_os_log_pending_writes": true, + "Innodb_os_log_written": true, + "Innodb_row_lock_current_waits": true, + "Innodb_rows_inserted": true, + "Innodb_rows_read": true, + "Innodb_rows_updated": true, + "Innodb_rows_deleted": true, + "Innodb_buffer_pool_pages_data": true, + "Innodb_buffer_pool_pages_dirty": true, + "Innodb_buffer_pool_pages_free": true, + "Innodb_buffer_pool_pages_flushed": true, + "Innodb_buffer_pool_pages_misc": true, + "Innodb_buffer_pool_pages_total": true, + "Innodb_buffer_pool_bytes_data": true, + "Innodb_buffer_pool_bytes_dirty": true, + "Innodb_buffer_pool_read_ahead": true, + "Innodb_buffer_pool_read_ahead_evicted": true, + "Innodb_buffer_pool_read_ahead_rnd": true, + "Innodb_buffer_pool_read_requests": true, + "Innodb_buffer_pool_write_requests": true, + "Innodb_buffer_pool_reads": true, + "Innodb_buffer_pool_wait_free": true, + "Innodb_deadlocks": true, + "Qcache_hits": true, + "Qcache_lowmem_prunes": true, + "Qcache_inserts": true, + "Qcache_not_cached": true, + "Qcache_queries_in_cache": true, + "Qcache_free_memory": true, + "Qcache_free_blocks": true, + "Qcache_total_blocks": true, + "Key_blocks_unused": true, + "Key_blocks_used": true, + "Key_blocks_not_flushed": true, + "Key_read_requests": true, + "Key_write_requests": true, + "Key_reads": true, + "Key_writes": true, + "Open_files": true, + "Opened_files": true, + "Binlog_stmt_cache_disk_use": true, + "Binlog_stmt_cache_use": true, + "Connection_errors_accept": true, + "Connection_errors_internal": true, + "Connection_errors_max_connections": true, + "Connection_errors_peer_address": true, + "Connection_errors_select": true, + "Connection_errors_tcpwrap": true, + "Com_delete": true, + "Com_insert": true, + "Com_select": true, + "Com_update": true, + "Com_replace": true, + "Opened_tables": true, + "Open_tables": true, + "wsrep_local_recv_queue": true, + "wsrep_local_send_queue": true, + "wsrep_received": true, + "wsrep_replicated": true, + "wsrep_received_bytes": true, + "wsrep_replicated_bytes": true, + "wsrep_local_bf_aborts": true, + "wsrep_local_cert_failures": true, + "wsrep_flow_control_paused_ns": true, + "wsrep_cluster_weight": true, + "wsrep_cluster_size": true, + "wsrep_local_state": true, + "wsrep_open_transactions": true, + "wsrep_thread_count": true, + "wsrep_connected": true, + "wsrep_ready": true, + "wsrep_cluster_status": true, +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect_global_vars.go b/src/go/collectors/go.d.plugin/modules/mysql/collect_global_vars.go new file mode 100644 index 000000000..ae6278088 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect_global_vars.go @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +const ( + queryShowGlobalVariables = ` +SHOW GLOBAL VARIABLES +WHERE + Variable_name LIKE 'max_connections' + OR Variable_name LIKE 'table_open_cache' + OR Variable_name LIKE 'disabled_storage_engines' + OR Variable_name LIKE 'log_bin' + OR Variable_name LIKE 'performance_schema';` +) + +func (m *MySQL) collectGlobalVariables() error { + // MariaDB: https://mariadb.com/kb/en/server-system-variables/ + // MySQL: https://dev.mysql.com/doc/refman/8.0/en/server-system-variable-reference.html + q := queryShowGlobalVariables + m.Debugf("executing query: '%s'", q) + + var name string + _, err := m.collectQuery(q, func(column, value string, _ bool) { + switch column { + case "Variable_name": + name = value + case "Value": + switch name { + case "disabled_storage_engines": + m.varDisabledStorageEngine = value + case "log_bin": + m.varLogBin = value + case "max_connections": + m.varMaxConns = parseInt(value) + case "performance_schema": + m.varPerformanceSchema = value + case "table_open_cache": + m.varTableOpenCache = parseInt(value) + } + } + }) + return err +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect_process_list.go b/src/go/collectors/go.d.plugin/modules/mysql/collect_process_list.go new file mode 100644 index 000000000..08c08c6d5 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect_process_list.go @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "github.com/blang/semver/v4" +) + +// Table Schema: +// (MariaDB) https://mariadb.com/kb/en/information-schema-processlist-table/ +// (MySql) https://dev.mysql.com/doc/refman/5.7/en/information-schema-processlist-table.html +const ( + queryShowProcessList = ` +SELECT + time, + user +FROM + information_schema.processlist +WHERE + info IS NOT NULL + AND info NOT LIKE '%PROCESSLIST%' +ORDER BY + time;` +) + +// Performance Schema +// (MySQL) https://dev.mysql.com/doc/refman/8.0/en/performance-schema-processlist-table.html +const ( + queryShowProcessListPS = ` +SELECT + time, + user +FROM + performance_schema.processlist +WHERE + info IS NOT NULL + AND info NOT LIKE '%PROCESSLIST%' +ORDER BY + time;` +) + +func (m *MySQL) collectProcessListStatistics(mx map[string]int64) error { + var q string + mysqlMinVer := semver.Version{Major: 8, Minor: 0, Patch: 22} + if !m.isMariaDB && m.version.GTE(mysqlMinVer) && m.varPerformanceSchema == "ON" { + q = queryShowProcessListPS + } else { + q = queryShowProcessList + } + m.Debugf("executing query: '%s'", q) + + var maxTime int64 // slowest query milliseconds in process list + + duration, err := m.collectQuery(q, func(column, value string, _ bool) { + switch column { + case "time": + maxTime = parseInt(value) + case "user": + // system user refers to non-client threads + // event_scheduler is the thread used to monitor scheduled events + // system user and event_scheduler threads are grouped as system/database threads + // authenticated and unauthenticated user are grouped as users + // please see USER section in + // https://dev.mysql.com/doc/refman/8.0/en/information-schema-processlist-table.html + switch value { + case "system user", "event_scheduler": + mx["process_list_queries_count_system"] += 1 + default: + mx["process_list_queries_count_user"] += 1 + } + } + }) + if err != nil { + return err + } + + if _, ok := mx["process_list_queries_count_system"]; !ok { + mx["process_list_queries_count_system"] = 0 + } + if _, ok := mx["process_list_queries_count_user"]; !ok { + mx["process_list_queries_count_user"] = 0 + } + mx["process_list_fetch_query_duration"] = duration + mx["process_list_longest_query_duration"] = maxTime + + return nil +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect_slave_status.go b/src/go/collectors/go.d.plugin/modules/mysql/collect_slave_status.go new file mode 100644 index 000000000..37d4bf59b --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect_slave_status.go @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "strings" + + "github.com/blang/semver/v4" +) + +const ( + queryShowReplicaStatus = "SHOW REPLICA STATUS;" + queryShowSlaveStatus = "SHOW SLAVE STATUS;" + queryShowAllSlavesStatus = "SHOW ALL SLAVES STATUS;" +) + +func (m *MySQL) collectSlaveStatus(mx map[string]int64) error { + // https://mariadb.com/docs/reference/es/sql-statements/SHOW_ALL_SLAVES_STATUS/ + mariaDBMinVer := semver.Version{Major: 10, Minor: 2, Patch: 0} + mysqlMinVer := semver.Version{Major: 8, Minor: 0, Patch: 22} + var q string + if m.isMariaDB && m.version.GTE(mariaDBMinVer) { + q = queryShowAllSlavesStatus + } else if !m.isMariaDB && m.version.GTE(mysqlMinVer) { + q = queryShowReplicaStatus + } else { + q = queryShowSlaveStatus + } + m.Debugf("executing query: '%s'", q) + + v := struct { + name string + behindMaster int64 + sqlRunning int64 + ioRunning int64 + }{} + + _, err := m.collectQuery(q, func(column, value string, lineEnd bool) { + switch column { + case "Connection_name", "Channel_Name": + v.name = value + case "Seconds_Behind_Master", "Seconds_Behind_Source": + v.behindMaster = parseInt(value) + case "Slave_SQL_Running", "Replica_SQL_Running": + v.sqlRunning = parseInt(convertSlaveSQLRunning(value)) + case "Slave_IO_Running", "Replica_IO_Running": + v.ioRunning = parseInt(convertSlaveIORunning(value)) + } + if lineEnd { + if !m.collectedReplConns[v.name] { + m.collectedReplConns[v.name] = true + m.addSlaveReplicationConnCharts(v.name) + } + s := strings.ToLower(slaveMetricSuffix(v.name)) + mx["seconds_behind_master"+s] = v.behindMaster + mx["slave_sql_running"+s] = v.sqlRunning + mx["slave_io_running"+s] = v.ioRunning + } + }) + return err +} + +func convertSlaveSQLRunning(value string) string { + switch value { + case "Yes": + return "1" + default: + return "0" + } +} + +func convertSlaveIORunning(value string) string { + // NOTE: There is 'Connecting' state and probably others + switch value { + case "Yes": + return "1" + default: + return "0" + } +} + +func slaveMetricSuffix(conn string) string { + if conn == "" { + return "" + } + return "_" + conn +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect_user_statistics.go b/src/go/collectors/go.d.plugin/modules/mysql/collect_user_statistics.go new file mode 100644 index 000000000..b00703a46 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect_user_statistics.go @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "strings" +) + +const queryShowUserStatistics = "SHOW USER_STATISTICS;" + +func (m *MySQL) collectUserStatistics(mx map[string]int64) error { + // https://mariadb.com/kb/en/user-statistics/ + // https://mariadb.com/kb/en/information-schema-user_statistics-table/ + q := queryShowUserStatistics + m.Debugf("executing query: '%s'", q) + + var user, prefix string + _, err := m.collectQuery(q, func(column, value string, _ bool) { + switch column { + case "User": + user = value + prefix = "userstats_" + user + "_" + if !m.collectedUsers[user] { + m.collectedUsers[user] = true + m.addUserStatisticsCharts(user) + } + case "Cpu_time": + mx[strings.ToLower(prefix+column)] = int64(parseFloat(value) * 1000) + case + "Total_connections", + "Lost_connections", + "Denied_connections", + "Empty_queries", + "Binlog_bytes_written", + "Rows_read", + "Rows_sent", + "Rows_deleted", + "Rows_inserted", + "Rows_updated", + "Rows_fetched", // Percona + "Select_commands", + "Update_commands", + "Other_commands", + "Access_denied", + "Commit_transactions", + "Rollback_transactions": + mx[strings.ToLower(prefix+column)] = parseInt(value) + } + }) + return err +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/collect_version.go b/src/go/collectors/go.d.plugin/modules/mysql/collect_version.go new file mode 100644 index 000000000..b85922e2c --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/collect_version.go @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "fmt" + "regexp" + "strings" + + "github.com/blang/semver/v4" +) + +const queryShowVersion = ` +SHOW GLOBAL VARIABLES +WHERE + Variable_name LIKE 'version' + OR Variable_name LIKE 'version_comment';` + +var reVersionCore = regexp.MustCompile(`^\d+\.\d+\.\d+`) + +func (m *MySQL) collectVersion() error { + // https://mariadb.com/kb/en/version/ + q := queryShowVersion + m.Debugf("executing query: '%s'", queryShowVersion) + + var name, version, versionComment string + _, err := m.collectQuery(q, func(column, value string, _ bool) { + switch column { + case "Variable_name": + name = value + case "Value": + switch name { + case "version": + version = value + case "version_comment": + versionComment = value + } + } + }) + if err != nil { + return err + } + + m.Infof("application version: '%s', version_comment: '%s'", version, versionComment) + + // version string is not always valid semver (ex.: 8.0.22-0ubuntu0.20.04.2) + s := reVersionCore.FindString(version) + if s == "" { + return fmt.Errorf("couldn't parse version string '%s'", version) + } + + ver, err := semver.New(s) + if err != nil { + return fmt.Errorf("couldn't parse version string '%s': %v", s, err) + } + + m.version = ver + m.isMariaDB = strings.Contains(version, "MariaDB") || strings.Contains(versionComment, "mariadb") + m.isPercona = strings.Contains(versionComment, "Percona") + + return nil +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/config_schema.json b/src/go/collectors/go.d.plugin/modules/mysql/config_schema.json new file mode 100644 index 000000000..20bb265c0 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/config_schema.json @@ -0,0 +1,52 @@ +{ + "jsonSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MySQL collector configuration.", + "type": "object", + "properties": { + "update_every": { + "title": "Update every", + "description": "Data collection interval, measured in seconds.", + "type": "integer", + "minimum": 1, + "default": 1 + }, + "dsn": { + "title": "DSN", + "description": "MySQL server [Data Source Name (DSN)](https://github.com/go-sql-driver/mysql#dsn-data-source-name) specifying the connection details.", + "type": "string", + "default": "netdata@tcp(localhost:3306)/" + }, + "timeout": { + "title": "Timeout", + "description": "Timeout for queries, in seconds.", + "type": "number", + "minimum": 0.5, + "default": 1 + }, + "my.cnf": { + "title": "my.cnf path", + "description": "Optional. Specifies the path to the my.cnf file containing connection settings under the [client] section.", + "type": "string" + } + }, + "required": [ + "dsn" + ], + "additionalProperties": false, + "patternProperties": { + "^name$": {} + } + }, + "uiSchema": { + "uiOptions": { + "fullPage": true + }, + "dsn": { + "ui:placeholder": "username:password@protocol(address)/dbname" + }, + "timeout": { + "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)." + } + } +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go b/src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go new file mode 100644 index 000000000..3a2eea6a1 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +const ( + queryShowSessionVariables = ` +SHOW SESSION VARIABLES +WHERE + Variable_name LIKE 'sql_log_off' + OR Variable_name LIKE 'slow_query_log';` +) + +const ( + queryDisableSessionQueryLog = "SET SESSION sql_log_off='ON';" + queryDisableSessionSlowQueryLog = "SET SESSION slow_query_log='OFF';" +) + +func (m *MySQL) disableSessionQueryLog() { + q := queryShowSessionVariables + m.Debugf("executing query: '%s'", q) + + var sqlLogOff, slowQueryLog string + var name string + _, err := m.collectQuery(q, func(column, value string, _ bool) { + switch column { + case "Variable_name": + name = value + case "Value": + switch name { + case "sql_log_off": + sqlLogOff = value + case "slow_query_log": + slowQueryLog = value + } + } + }) + if err != nil { + m.Debug(err) + return + } + + if sqlLogOff == "OFF" && m.doDisableSessionQueryLog { + // requires SUPER privileges + q = queryDisableSessionQueryLog + m.Debugf("executing query: '%s'", q) + if _, err := m.collectQuery(q, func(_, _ string, _ bool) {}); err != nil { + m.Infof("failed to disable session query log (sql_log_off): %v", err) + m.doDisableSessionQueryLog = false + } + } + if slowQueryLog == "ON" { + q = queryDisableSessionSlowQueryLog + m.Debugf("executing query: '%s'", q) + if _, err := m.collectQuery(q, func(_, _ string, _ bool) {}); err != nil { + m.Debugf("failed to disable session slow query log (slow_query_log): %v", err) + } + } +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/integrations/mariadb.md b/src/go/collectors/go.d.plugin/modules/mysql/integrations/mariadb.md new file mode 100644 index 000000000..52eef9998 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/integrations/mariadb.md @@ -0,0 +1,370 @@ +<!--startmeta +custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/mysql/integrations/mariadb.md" +meta_yaml: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/mysql/metadata.yaml" +sidebar_label: "MariaDB" +learn_status: "Published" +learn_rel_path: "Collecting Metrics/Databases" +most_popular: True +message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" +endmeta--> + +# MariaDB + + +<img src="https://netdata.cloud/img/mariadb.svg" width="150"/> + + +Plugin: go.d.plugin +Module: mysql + +<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> + +## Overview + +This collector monitors the health and performance of MySQL servers and collects general statistics, replication and user metrics. + + +It connects to the MySQL instance via a TCP or UNIX socket and executes the following commands: + +Executed queries: + +- `SELECT VERSION();` +- `SHOW GLOBAL STATUS;` +- `SHOW GLOBAL VARIABLES;` +- `SHOW SLAVE STATUS;` or `SHOW ALL SLAVES STATUS;` (MariaDBv10.2+) or `SHOW REPLICA STATUS;` (MySQL 8.0.22+) +- `SHOW USER_STATISTICS;` (MariaDBv10.1.1+) +- `SELECT TIME,USER FROM INFORMATION_SCHEMA.PROCESSLIST;` + + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + + +### Default Behavior + +#### Auto-Detection + +By default, it detects instances running on localhost by trying to connect as root and netdata using known MySQL TCP and UNIX sockets: + +- /var/run/mysqld/mysqld.sock +- /var/run/mysqld/mysql.sock +- /var/lib/mysql/mysql.sock +- /tmp/mysql.sock +- 127.0.0.1:3306 +- "[::1]:3306" + + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per MariaDB instance + +These metrics refer to the entire monitored application. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.net | in, out | kilobits/s | • | • | • | +| mysql.queries | queries, questions, slow_queries | queries/s | • | • | • | +| mysql.queries_type | select, delete, update, insert, replace | queries/s | • | • | • | +| mysql.handlers | commit, delete, prepare, read_first, read_key, read_next, read_prev, read_rnd, read_rnd_next, rollback, savepoint, savepointrollback, update, write | handlers/s | • | • | • | +| mysql.table_open_cache_overflows | open_cache | overflows/s | • | • | • | +| mysql.table_locks | immediate, waited | locks/s | • | • | • | +| mysql.join_issues | full_join, full_range_join, range, range_check, scan | joins/s | • | • | • | +| mysql.sort_issues | merge_passes, range, scan | issues/s | • | • | • | +| mysql.tmp | disk_tables, files, tables | events/s | • | • | • | +| mysql.connections | all, aborted | connections/s | • | • | • | +| mysql.connections_active | active, limit, max_active | connections | • | • | • | +| mysql.threads | connected, cached, running | threads | • | • | • | +| mysql.threads_created | created | threads/s | • | • | • | +| mysql.thread_cache_misses | misses | misses | • | • | • | +| mysql.innodb_io | read, write | KiB/s | • | • | • | +| mysql.innodb_io_ops | reads, writes, fsyncs | operations/s | • | • | • | +| mysql.innodb_io_pending_ops | reads, writes, fsyncs | operations | • | • | • | +| mysql.innodb_log | waits, write_requests, writes | operations/s | • | • | • | +| mysql.innodb_cur_row_lock | current waits | operations | • | • | • | +| mysql.innodb_rows | inserted, read, updated, deleted | operations/s | • | • | • | +| mysql.innodb_buffer_pool_pages | data, dirty, free, misc, total | pages | • | • | • | +| mysql.innodb_buffer_pool_pages_flushed | flush_pages | requests/s | • | • | • | +| mysql.innodb_buffer_pool_bytes | data, dirty | MiB | • | • | • | +| mysql.innodb_buffer_pool_read_ahead | all, evicted | pages/s | • | • | • | +| mysql.innodb_buffer_pool_read_ahead_rnd | read-ahead | operations/s | • | • | • | +| mysql.innodb_buffer_pool_ops | disk_reads, wait_free | operations/s | • | • | • | +| mysql.innodb_os_log | fsyncs, writes | operations | • | • | • | +| mysql.innodb_os_log_fsync_writes | fsyncs | operations/s | • | • | • | +| mysql.innodb_os_log_io | write | KiB/s | • | • | • | +| mysql.innodb_deadlocks | deadlocks | operations/s | • | • | • | +| mysql.files | files | files | • | • | • | +| mysql.files_rate | files | files/s | • | • | • | +| mysql.connection_errors | accept, internal, max, peer_addr, select, tcpwrap | errors/s | • | • | • | +| mysql.opened_tables | tables | tables/s | • | • | • | +| mysql.open_tables | cache, tables | tables | • | • | • | +| mysql.process_list_fetch_query_duration | duration | milliseconds | • | • | • | +| mysql.process_list_queries_count | system, user | queries | • | • | • | +| mysql.process_list_longest_query_duration | duration | seconds | • | • | • | +| mysql.qcache_ops | hits, lowmem_prunes, inserts, not_cached | queries/s | • | • | • | +| mysql.qcache | queries | queries | • | • | • | +| mysql.qcache_freemem | free | MiB | • | • | • | +| mysql.qcache_memblocks | free, total | blocks | • | • | • | +| mysql.galera_writesets | rx, tx | writesets/s | • | • | • | +| mysql.galera_bytes | rx, tx | KiB/s | • | • | • | +| mysql.galera_queue | rx, tx | writesets | • | • | • | +| mysql.galera_conflicts | bf_aborts, cert_fails | transactions | • | • | • | +| mysql.galera_flow_control | paused | ms | • | • | • | +| mysql.galera_cluster_status | primary, non_primary, disconnected | status | • | • | • | +| mysql.galera_cluster_state | undefined, joining, donor, joined, synced, error | state | • | • | • | +| mysql.galera_cluster_size | nodes | nodes | • | • | • | +| mysql.galera_cluster_weight | weight | weight | • | • | • | +| mysql.galera_connected | connected | boolean | • | • | • | +| mysql.galera_ready | ready | boolean | • | • | • | +| mysql.galera_open_transactions | open | transactions | • | • | • | +| mysql.galera_thread_count | threads | threads | • | • | • | +| mysql.key_blocks | unused, used, not_flushed | blocks | • | • | • | +| mysql.key_requests | reads, writes | requests/s | • | • | • | +| mysql.key_disk_ops | reads, writes | operations/s | • | • | • | +| mysql.binlog_cache | disk, all | transactions/s | • | • | • | +| mysql.binlog_stmt_cache | disk, all | statements/s | • | • | • | + +### Per connection + +These metrics refer to the replication connection. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.slave_behind | seconds | seconds | • | • | • | +| mysql.slave_status | sql_running, io_running | boolean | • | • | • | + +### Per user + +These metrics refer to the MySQL user. + +Labels: + +| Label | Description | +|:-----------|:----------------| +| user | username | + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.userstats_cpu | used | percentage | | • | • | +| mysql.userstats_rows | read, sent, updated, inserted, deleted | operations/s | | • | • | +| mysql.userstats_commands | select, update, other | commands/s | | • | • | +| mysql.userstats_denied_commands | denied | commands/s | | • | • | +| mysql.userstats_created_transactions | commit, rollback | transactions/s | | • | • | +| mysql.userstats_binlog_written | written | B/s | | • | • | +| mysql.userstats_empty_queries | empty | queries/s | | • | • | +| mysql.userstats_connections | created | connections/s | | • | • | +| mysql.userstats_lost_connections | lost | connections/s | | • | • | +| mysql.userstats_denied_connections | denied | connections/s | | • | • | + + + +## Alerts + + +The following alerts are available: + +| Alert name | On metric | Description | +|:------------|:----------|:------------| +| [ mysql_10s_slow_queries ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.queries | number of slow queries in the last 10 seconds | +| [ mysql_10s_table_locks_immediate ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | number of table immediate locks in the last 10 seconds | +| [ mysql_10s_table_locks_waited ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | number of table waited locks in the last 10 seconds | +| [ mysql_10s_waited_locks_ratio ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | ratio of waited table locks over the last 10 seconds | +| [ mysql_connections ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.connections_active | client connections utilization | +| [ mysql_replication ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.slave_status | replication status (0: stopped, 1: working) | +| [ mysql_replication_lag ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.slave_behind | difference between the timestamp of the latest transaction processed by the SQL thread and the timestamp of the same transaction when it was processed on the master | +| [ mysql_galera_cluster_size_max_2m ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_size | maximum galera cluster size in the last 2 minutes starting one minute ago | +| [ mysql_galera_cluster_size ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_size | current galera cluster size, compared to the maximum size in the last 2 minutes | +| [ mysql_galera_cluster_state_warn ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_state | galera node state is either Donor/Desynced or Joined | +| [ mysql_galera_cluster_state_crit ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_state | galera node state is either Undefined or Joining or Error | +| [ mysql_galera_cluster_status ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_status | galera node is part of a nonoperational component. This occurs in cases of multiple membership changes that result in a loss of Quorum or in cases of split-brain situations. | + + +## Setup + +### Prerequisites + +#### Create netdata user + +A user account should have the +following [permissions](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html): + +- [`USAGE`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_usage) +- [`REPLICATION CLIENT`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_replication-client) +- [`PROCESS`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_process) + +To create the `netdata` user with these permissions, execute the following in the MySQL shell: + +```mysql +CREATE USER 'netdata'@'localhost'; +GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost'; +FLUSH PRIVILEGES; +``` + +The `netdata` user will have the ability to connect to the MySQL server on localhost without a password. It will only +be able to gather statistics without being able to alter or affect operations in any way. + + + +### Configuration + +#### File + +The configuration file name for this integration is `go.d/mysql.conf`. + + +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config go.d/mysql.conf +``` +#### Options + +The following options can be defined globally: update_every, autodetection_retry. + + +<details><summary>Config options</summary> + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| update_every | Data collection frequency. | 5 | no | +| autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | +| dsn | MySQL server DSN (Data Source Name). See [DSN syntax](https://github.com/go-sql-driver/mysql#dsn-data-source-name). | root@tcp(localhost:3306)/ | yes | +| my.cnf | Specifies the my.cnf file to read the connection settings from the [client] section. | | no | +| timeout | Query timeout in seconds. | 1 | no | + +</details> + +#### Examples + +##### TCP socket + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + +``` +</details> + +##### Unix socket + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@unix(/var/lib/mysql/mysql.sock)/ + +``` +</details> + +##### Connection with password + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netconfig:password@tcp(127.0.0.1:3306)/ + +``` +</details> + +##### my.cnf + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + my.cnf: '/etc/my.cnf' + +``` +</details> + +##### Multi-instance + +> **Note**: When you define multiple jobs, their names must be unique. + +Local and remote instances. + + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + + - name: remote + dsn: netconfig:password@tcp(203.0.113.0:3306)/ + +``` +</details> + + + +## Troubleshooting + +### Debug Mode + +To troubleshoot issues with the `mysql` collector, run the `go.d.plugin` with the debug option enabled. The output +should give you clues as to why the collector isn't working. + +- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on + your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. + + ```bash + cd /usr/libexec/netdata/plugins.d/ + ``` + +- Switch to the `netdata` user. + + ```bash + sudo -u netdata -s + ``` + +- Run the `go.d.plugin` to debug the collector: + + ```bash + ./go.d.plugin -d -m mysql + ``` + + diff --git a/src/go/collectors/go.d.plugin/modules/mysql/integrations/mysql.md b/src/go/collectors/go.d.plugin/modules/mysql/integrations/mysql.md new file mode 100644 index 000000000..e53382e10 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/integrations/mysql.md @@ -0,0 +1,370 @@ +<!--startmeta +custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/mysql/integrations/mysql.md" +meta_yaml: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/mysql/metadata.yaml" +sidebar_label: "MySQL" +learn_status: "Published" +learn_rel_path: "Collecting Metrics/Databases" +most_popular: True +message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" +endmeta--> + +# MySQL + + +<img src="https://netdata.cloud/img/mysql.svg" width="150"/> + + +Plugin: go.d.plugin +Module: mysql + +<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> + +## Overview + +This collector monitors the health and performance of MySQL servers and collects general statistics, replication and user metrics. + + +It connects to the MySQL instance via a TCP or UNIX socket and executes the following commands: + +Executed queries: + +- `SELECT VERSION();` +- `SHOW GLOBAL STATUS;` +- `SHOW GLOBAL VARIABLES;` +- `SHOW SLAVE STATUS;` or `SHOW ALL SLAVES STATUS;` (MariaDBv10.2+) or `SHOW REPLICA STATUS;` (MySQL 8.0.22+) +- `SHOW USER_STATISTICS;` (MariaDBv10.1.1+) +- `SELECT TIME,USER FROM INFORMATION_SCHEMA.PROCESSLIST;` + + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + + +### Default Behavior + +#### Auto-Detection + +By default, it detects instances running on localhost by trying to connect as root and netdata using known MySQL TCP and UNIX sockets: + +- /var/run/mysqld/mysqld.sock +- /var/run/mysqld/mysql.sock +- /var/lib/mysql/mysql.sock +- /tmp/mysql.sock +- 127.0.0.1:3306 +- "[::1]:3306" + + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per MariaDB instance + +These metrics refer to the entire monitored application. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.net | in, out | kilobits/s | • | • | • | +| mysql.queries | queries, questions, slow_queries | queries/s | • | • | • | +| mysql.queries_type | select, delete, update, insert, replace | queries/s | • | • | • | +| mysql.handlers | commit, delete, prepare, read_first, read_key, read_next, read_prev, read_rnd, read_rnd_next, rollback, savepoint, savepointrollback, update, write | handlers/s | • | • | • | +| mysql.table_open_cache_overflows | open_cache | overflows/s | • | • | • | +| mysql.table_locks | immediate, waited | locks/s | • | • | • | +| mysql.join_issues | full_join, full_range_join, range, range_check, scan | joins/s | • | • | • | +| mysql.sort_issues | merge_passes, range, scan | issues/s | • | • | • | +| mysql.tmp | disk_tables, files, tables | events/s | • | • | • | +| mysql.connections | all, aborted | connections/s | • | • | • | +| mysql.connections_active | active, limit, max_active | connections | • | • | • | +| mysql.threads | connected, cached, running | threads | • | • | • | +| mysql.threads_created | created | threads/s | • | • | • | +| mysql.thread_cache_misses | misses | misses | • | • | • | +| mysql.innodb_io | read, write | KiB/s | • | • | • | +| mysql.innodb_io_ops | reads, writes, fsyncs | operations/s | • | • | • | +| mysql.innodb_io_pending_ops | reads, writes, fsyncs | operations | • | • | • | +| mysql.innodb_log | waits, write_requests, writes | operations/s | • | • | • | +| mysql.innodb_cur_row_lock | current waits | operations | • | • | • | +| mysql.innodb_rows | inserted, read, updated, deleted | operations/s | • | • | • | +| mysql.innodb_buffer_pool_pages | data, dirty, free, misc, total | pages | • | • | • | +| mysql.innodb_buffer_pool_pages_flushed | flush_pages | requests/s | • | • | • | +| mysql.innodb_buffer_pool_bytes | data, dirty | MiB | • | • | • | +| mysql.innodb_buffer_pool_read_ahead | all, evicted | pages/s | • | • | • | +| mysql.innodb_buffer_pool_read_ahead_rnd | read-ahead | operations/s | • | • | • | +| mysql.innodb_buffer_pool_ops | disk_reads, wait_free | operations/s | • | • | • | +| mysql.innodb_os_log | fsyncs, writes | operations | • | • | • | +| mysql.innodb_os_log_fsync_writes | fsyncs | operations/s | • | • | • | +| mysql.innodb_os_log_io | write | KiB/s | • | • | • | +| mysql.innodb_deadlocks | deadlocks | operations/s | • | • | • | +| mysql.files | files | files | • | • | • | +| mysql.files_rate | files | files/s | • | • | • | +| mysql.connection_errors | accept, internal, max, peer_addr, select, tcpwrap | errors/s | • | • | • | +| mysql.opened_tables | tables | tables/s | • | • | • | +| mysql.open_tables | cache, tables | tables | • | • | • | +| mysql.process_list_fetch_query_duration | duration | milliseconds | • | • | • | +| mysql.process_list_queries_count | system, user | queries | • | • | • | +| mysql.process_list_longest_query_duration | duration | seconds | • | • | • | +| mysql.qcache_ops | hits, lowmem_prunes, inserts, not_cached | queries/s | • | • | • | +| mysql.qcache | queries | queries | • | • | • | +| mysql.qcache_freemem | free | MiB | • | • | • | +| mysql.qcache_memblocks | free, total | blocks | • | • | • | +| mysql.galera_writesets | rx, tx | writesets/s | • | • | • | +| mysql.galera_bytes | rx, tx | KiB/s | • | • | • | +| mysql.galera_queue | rx, tx | writesets | • | • | • | +| mysql.galera_conflicts | bf_aborts, cert_fails | transactions | • | • | • | +| mysql.galera_flow_control | paused | ms | • | • | • | +| mysql.galera_cluster_status | primary, non_primary, disconnected | status | • | • | • | +| mysql.galera_cluster_state | undefined, joining, donor, joined, synced, error | state | • | • | • | +| mysql.galera_cluster_size | nodes | nodes | • | • | • | +| mysql.galera_cluster_weight | weight | weight | • | • | • | +| mysql.galera_connected | connected | boolean | • | • | • | +| mysql.galera_ready | ready | boolean | • | • | • | +| mysql.galera_open_transactions | open | transactions | • | • | • | +| mysql.galera_thread_count | threads | threads | • | • | • | +| mysql.key_blocks | unused, used, not_flushed | blocks | • | • | • | +| mysql.key_requests | reads, writes | requests/s | • | • | • | +| mysql.key_disk_ops | reads, writes | operations/s | • | • | • | +| mysql.binlog_cache | disk, all | transactions/s | • | • | • | +| mysql.binlog_stmt_cache | disk, all | statements/s | • | • | • | + +### Per connection + +These metrics refer to the replication connection. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.slave_behind | seconds | seconds | • | • | • | +| mysql.slave_status | sql_running, io_running | boolean | • | • | • | + +### Per user + +These metrics refer to the MySQL user. + +Labels: + +| Label | Description | +|:-----------|:----------------| +| user | username | + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.userstats_cpu | used | percentage | | • | • | +| mysql.userstats_rows | read, sent, updated, inserted, deleted | operations/s | | • | • | +| mysql.userstats_commands | select, update, other | commands/s | | • | • | +| mysql.userstats_denied_commands | denied | commands/s | | • | • | +| mysql.userstats_created_transactions | commit, rollback | transactions/s | | • | • | +| mysql.userstats_binlog_written | written | B/s | | • | • | +| mysql.userstats_empty_queries | empty | queries/s | | • | • | +| mysql.userstats_connections | created | connections/s | | • | • | +| mysql.userstats_lost_connections | lost | connections/s | | • | • | +| mysql.userstats_denied_connections | denied | connections/s | | • | • | + + + +## Alerts + + +The following alerts are available: + +| Alert name | On metric | Description | +|:------------|:----------|:------------| +| [ mysql_10s_slow_queries ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.queries | number of slow queries in the last 10 seconds | +| [ mysql_10s_table_locks_immediate ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | number of table immediate locks in the last 10 seconds | +| [ mysql_10s_table_locks_waited ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | number of table waited locks in the last 10 seconds | +| [ mysql_10s_waited_locks_ratio ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | ratio of waited table locks over the last 10 seconds | +| [ mysql_connections ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.connections_active | client connections utilization | +| [ mysql_replication ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.slave_status | replication status (0: stopped, 1: working) | +| [ mysql_replication_lag ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.slave_behind | difference between the timestamp of the latest transaction processed by the SQL thread and the timestamp of the same transaction when it was processed on the master | +| [ mysql_galera_cluster_size_max_2m ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_size | maximum galera cluster size in the last 2 minutes starting one minute ago | +| [ mysql_galera_cluster_size ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_size | current galera cluster size, compared to the maximum size in the last 2 minutes | +| [ mysql_galera_cluster_state_warn ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_state | galera node state is either Donor/Desynced or Joined | +| [ mysql_galera_cluster_state_crit ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_state | galera node state is either Undefined or Joining or Error | +| [ mysql_galera_cluster_status ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_status | galera node is part of a nonoperational component. This occurs in cases of multiple membership changes that result in a loss of Quorum or in cases of split-brain situations. | + + +## Setup + +### Prerequisites + +#### Create netdata user + +A user account should have the +following [permissions](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html): + +- [`USAGE`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_usage) +- [`REPLICATION CLIENT`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_replication-client) +- [`PROCESS`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_process) + +To create the `netdata` user with these permissions, execute the following in the MySQL shell: + +```mysql +CREATE USER 'netdata'@'localhost'; +GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost'; +FLUSH PRIVILEGES; +``` + +The `netdata` user will have the ability to connect to the MySQL server on localhost without a password. It will only +be able to gather statistics without being able to alter or affect operations in any way. + + + +### Configuration + +#### File + +The configuration file name for this integration is `go.d/mysql.conf`. + + +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config go.d/mysql.conf +``` +#### Options + +The following options can be defined globally: update_every, autodetection_retry. + + +<details><summary>Config options</summary> + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| update_every | Data collection frequency. | 5 | no | +| autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | +| dsn | MySQL server DSN (Data Source Name). See [DSN syntax](https://github.com/go-sql-driver/mysql#dsn-data-source-name). | root@tcp(localhost:3306)/ | yes | +| my.cnf | Specifies the my.cnf file to read the connection settings from the [client] section. | | no | +| timeout | Query timeout in seconds. | 1 | no | + +</details> + +#### Examples + +##### TCP socket + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + +``` +</details> + +##### Unix socket + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@unix(/var/lib/mysql/mysql.sock)/ + +``` +</details> + +##### Connection with password + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netconfig:password@tcp(127.0.0.1:3306)/ + +``` +</details> + +##### my.cnf + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + my.cnf: '/etc/my.cnf' + +``` +</details> + +##### Multi-instance + +> **Note**: When you define multiple jobs, their names must be unique. + +Local and remote instances. + + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + + - name: remote + dsn: netconfig:password@tcp(203.0.113.0:3306)/ + +``` +</details> + + + +## Troubleshooting + +### Debug Mode + +To troubleshoot issues with the `mysql` collector, run the `go.d.plugin` with the debug option enabled. The output +should give you clues as to why the collector isn't working. + +- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on + your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. + + ```bash + cd /usr/libexec/netdata/plugins.d/ + ``` + +- Switch to the `netdata` user. + + ```bash + sudo -u netdata -s + ``` + +- Run the `go.d.plugin` to debug the collector: + + ```bash + ./go.d.plugin -d -m mysql + ``` + + diff --git a/src/go/collectors/go.d.plugin/modules/mysql/integrations/percona_mysql.md b/src/go/collectors/go.d.plugin/modules/mysql/integrations/percona_mysql.md new file mode 100644 index 000000000..fcd2f1304 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/integrations/percona_mysql.md @@ -0,0 +1,370 @@ +<!--startmeta +custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/mysql/integrations/percona_mysql.md" +meta_yaml: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/mysql/metadata.yaml" +sidebar_label: "Percona MySQL" +learn_status: "Published" +learn_rel_path: "Collecting Metrics/Databases" +most_popular: False +message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" +endmeta--> + +# Percona MySQL + + +<img src="https://netdata.cloud/img/percona.svg" width="150"/> + + +Plugin: go.d.plugin +Module: mysql + +<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> + +## Overview + +This collector monitors the health and performance of MySQL servers and collects general statistics, replication and user metrics. + + +It connects to the MySQL instance via a TCP or UNIX socket and executes the following commands: + +Executed queries: + +- `SELECT VERSION();` +- `SHOW GLOBAL STATUS;` +- `SHOW GLOBAL VARIABLES;` +- `SHOW SLAVE STATUS;` or `SHOW ALL SLAVES STATUS;` (MariaDBv10.2+) or `SHOW REPLICA STATUS;` (MySQL 8.0.22+) +- `SHOW USER_STATISTICS;` (MariaDBv10.1.1+) +- `SELECT TIME,USER FROM INFORMATION_SCHEMA.PROCESSLIST;` + + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + + +### Default Behavior + +#### Auto-Detection + +By default, it detects instances running on localhost by trying to connect as root and netdata using known MySQL TCP and UNIX sockets: + +- /var/run/mysqld/mysqld.sock +- /var/run/mysqld/mysql.sock +- /var/lib/mysql/mysql.sock +- /tmp/mysql.sock +- 127.0.0.1:3306 +- "[::1]:3306" + + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per MariaDB instance + +These metrics refer to the entire monitored application. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.net | in, out | kilobits/s | • | • | • | +| mysql.queries | queries, questions, slow_queries | queries/s | • | • | • | +| mysql.queries_type | select, delete, update, insert, replace | queries/s | • | • | • | +| mysql.handlers | commit, delete, prepare, read_first, read_key, read_next, read_prev, read_rnd, read_rnd_next, rollback, savepoint, savepointrollback, update, write | handlers/s | • | • | • | +| mysql.table_open_cache_overflows | open_cache | overflows/s | • | • | • | +| mysql.table_locks | immediate, waited | locks/s | • | • | • | +| mysql.join_issues | full_join, full_range_join, range, range_check, scan | joins/s | • | • | • | +| mysql.sort_issues | merge_passes, range, scan | issues/s | • | • | • | +| mysql.tmp | disk_tables, files, tables | events/s | • | • | • | +| mysql.connections | all, aborted | connections/s | • | • | • | +| mysql.connections_active | active, limit, max_active | connections | • | • | • | +| mysql.threads | connected, cached, running | threads | • | • | • | +| mysql.threads_created | created | threads/s | • | • | • | +| mysql.thread_cache_misses | misses | misses | • | • | • | +| mysql.innodb_io | read, write | KiB/s | • | • | • | +| mysql.innodb_io_ops | reads, writes, fsyncs | operations/s | • | • | • | +| mysql.innodb_io_pending_ops | reads, writes, fsyncs | operations | • | • | • | +| mysql.innodb_log | waits, write_requests, writes | operations/s | • | • | • | +| mysql.innodb_cur_row_lock | current waits | operations | • | • | • | +| mysql.innodb_rows | inserted, read, updated, deleted | operations/s | • | • | • | +| mysql.innodb_buffer_pool_pages | data, dirty, free, misc, total | pages | • | • | • | +| mysql.innodb_buffer_pool_pages_flushed | flush_pages | requests/s | • | • | • | +| mysql.innodb_buffer_pool_bytes | data, dirty | MiB | • | • | • | +| mysql.innodb_buffer_pool_read_ahead | all, evicted | pages/s | • | • | • | +| mysql.innodb_buffer_pool_read_ahead_rnd | read-ahead | operations/s | • | • | • | +| mysql.innodb_buffer_pool_ops | disk_reads, wait_free | operations/s | • | • | • | +| mysql.innodb_os_log | fsyncs, writes | operations | • | • | • | +| mysql.innodb_os_log_fsync_writes | fsyncs | operations/s | • | • | • | +| mysql.innodb_os_log_io | write | KiB/s | • | • | • | +| mysql.innodb_deadlocks | deadlocks | operations/s | • | • | • | +| mysql.files | files | files | • | • | • | +| mysql.files_rate | files | files/s | • | • | • | +| mysql.connection_errors | accept, internal, max, peer_addr, select, tcpwrap | errors/s | • | • | • | +| mysql.opened_tables | tables | tables/s | • | • | • | +| mysql.open_tables | cache, tables | tables | • | • | • | +| mysql.process_list_fetch_query_duration | duration | milliseconds | • | • | • | +| mysql.process_list_queries_count | system, user | queries | • | • | • | +| mysql.process_list_longest_query_duration | duration | seconds | • | • | • | +| mysql.qcache_ops | hits, lowmem_prunes, inserts, not_cached | queries/s | • | • | • | +| mysql.qcache | queries | queries | • | • | • | +| mysql.qcache_freemem | free | MiB | • | • | • | +| mysql.qcache_memblocks | free, total | blocks | • | • | • | +| mysql.galera_writesets | rx, tx | writesets/s | • | • | • | +| mysql.galera_bytes | rx, tx | KiB/s | • | • | • | +| mysql.galera_queue | rx, tx | writesets | • | • | • | +| mysql.galera_conflicts | bf_aborts, cert_fails | transactions | • | • | • | +| mysql.galera_flow_control | paused | ms | • | • | • | +| mysql.galera_cluster_status | primary, non_primary, disconnected | status | • | • | • | +| mysql.galera_cluster_state | undefined, joining, donor, joined, synced, error | state | • | • | • | +| mysql.galera_cluster_size | nodes | nodes | • | • | • | +| mysql.galera_cluster_weight | weight | weight | • | • | • | +| mysql.galera_connected | connected | boolean | • | • | • | +| mysql.galera_ready | ready | boolean | • | • | • | +| mysql.galera_open_transactions | open | transactions | • | • | • | +| mysql.galera_thread_count | threads | threads | • | • | • | +| mysql.key_blocks | unused, used, not_flushed | blocks | • | • | • | +| mysql.key_requests | reads, writes | requests/s | • | • | • | +| mysql.key_disk_ops | reads, writes | operations/s | • | • | • | +| mysql.binlog_cache | disk, all | transactions/s | • | • | • | +| mysql.binlog_stmt_cache | disk, all | statements/s | • | • | • | + +### Per connection + +These metrics refer to the replication connection. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.slave_behind | seconds | seconds | • | • | • | +| mysql.slave_status | sql_running, io_running | boolean | • | • | • | + +### Per user + +These metrics refer to the MySQL user. + +Labels: + +| Label | Description | +|:-----------|:----------------| +| user | username | + +Metrics: + +| Metric | Dimensions | Unit | MySQL | MariaDB | Percona | +|:------|:----------|:----|:---:|:---:|:---:| +| mysql.userstats_cpu | used | percentage | | • | • | +| mysql.userstats_rows | read, sent, updated, inserted, deleted | operations/s | | • | • | +| mysql.userstats_commands | select, update, other | commands/s | | • | • | +| mysql.userstats_denied_commands | denied | commands/s | | • | • | +| mysql.userstats_created_transactions | commit, rollback | transactions/s | | • | • | +| mysql.userstats_binlog_written | written | B/s | | • | • | +| mysql.userstats_empty_queries | empty | queries/s | | • | • | +| mysql.userstats_connections | created | connections/s | | • | • | +| mysql.userstats_lost_connections | lost | connections/s | | • | • | +| mysql.userstats_denied_connections | denied | connections/s | | • | • | + + + +## Alerts + + +The following alerts are available: + +| Alert name | On metric | Description | +|:------------|:----------|:------------| +| [ mysql_10s_slow_queries ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.queries | number of slow queries in the last 10 seconds | +| [ mysql_10s_table_locks_immediate ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | number of table immediate locks in the last 10 seconds | +| [ mysql_10s_table_locks_waited ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | number of table waited locks in the last 10 seconds | +| [ mysql_10s_waited_locks_ratio ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.table_locks | ratio of waited table locks over the last 10 seconds | +| [ mysql_connections ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.connections_active | client connections utilization | +| [ mysql_replication ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.slave_status | replication status (0: stopped, 1: working) | +| [ mysql_replication_lag ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.slave_behind | difference between the timestamp of the latest transaction processed by the SQL thread and the timestamp of the same transaction when it was processed on the master | +| [ mysql_galera_cluster_size_max_2m ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_size | maximum galera cluster size in the last 2 minutes starting one minute ago | +| [ mysql_galera_cluster_size ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_size | current galera cluster size, compared to the maximum size in the last 2 minutes | +| [ mysql_galera_cluster_state_warn ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_state | galera node state is either Donor/Desynced or Joined | +| [ mysql_galera_cluster_state_crit ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_state | galera node state is either Undefined or Joining or Error | +| [ mysql_galera_cluster_status ](https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf) | mysql.galera_cluster_status | galera node is part of a nonoperational component. This occurs in cases of multiple membership changes that result in a loss of Quorum or in cases of split-brain situations. | + + +## Setup + +### Prerequisites + +#### Create netdata user + +A user account should have the +following [permissions](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html): + +- [`USAGE`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_usage) +- [`REPLICATION CLIENT`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_replication-client) +- [`PROCESS`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_process) + +To create the `netdata` user with these permissions, execute the following in the MySQL shell: + +```mysql +CREATE USER 'netdata'@'localhost'; +GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost'; +FLUSH PRIVILEGES; +``` + +The `netdata` user will have the ability to connect to the MySQL server on localhost without a password. It will only +be able to gather statistics without being able to alter or affect operations in any way. + + + +### Configuration + +#### File + +The configuration file name for this integration is `go.d/mysql.conf`. + + +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config go.d/mysql.conf +``` +#### Options + +The following options can be defined globally: update_every, autodetection_retry. + + +<details><summary>Config options</summary> + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| update_every | Data collection frequency. | 5 | no | +| autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | +| dsn | MySQL server DSN (Data Source Name). See [DSN syntax](https://github.com/go-sql-driver/mysql#dsn-data-source-name). | root@tcp(localhost:3306)/ | yes | +| my.cnf | Specifies the my.cnf file to read the connection settings from the [client] section. | | no | +| timeout | Query timeout in seconds. | 1 | no | + +</details> + +#### Examples + +##### TCP socket + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + +``` +</details> + +##### Unix socket + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@unix(/var/lib/mysql/mysql.sock)/ + +``` +</details> + +##### Connection with password + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netconfig:password@tcp(127.0.0.1:3306)/ + +``` +</details> + +##### my.cnf + +An example configuration. + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + my.cnf: '/etc/my.cnf' + +``` +</details> + +##### Multi-instance + +> **Note**: When you define multiple jobs, their names must be unique. + +Local and remote instances. + + +<details><summary>Config</summary> + +```yaml +jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + + - name: remote + dsn: netconfig:password@tcp(203.0.113.0:3306)/ + +``` +</details> + + + +## Troubleshooting + +### Debug Mode + +To troubleshoot issues with the `mysql` collector, run the `go.d.plugin` with the debug option enabled. The output +should give you clues as to why the collector isn't working. + +- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on + your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. + + ```bash + cd /usr/libexec/netdata/plugins.d/ + ``` + +- Switch to the `netdata` user. + + ```bash + sudo -u netdata -s + ``` + +- Run the `go.d.plugin` to debug the collector: + + ```bash + ./go.d.plugin -d -m mysql + ``` + + diff --git a/src/go/collectors/go.d.plugin/modules/mysql/metadata.yaml b/src/go/collectors/go.d.plugin/modules/mysql/metadata.yaml new file mode 100644 index 000000000..1bc133238 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/metadata.yaml @@ -0,0 +1,806 @@ +plugin_name: go.d.plugin +modules: + - &module + meta: &meta + id: collector-go.d.plugin-mysql + plugin_name: go.d.plugin + module_name: mysql + monitored_instance: + name: MySQL + link: https://www.mysql.com/ + categories: + - data-collection.database-servers + icon_filename: mysql.svg + related_resources: + integrations: + list: + - plugin_name: apps.plugin + module_name: apps + - plugin_name: cgroups.plugin + module_name: cgroups + info_provided_to_referring_integrations: + description: "" + keywords: + - "db" + - "database" + - "mysql" + - "maria" + - "mariadb" + - "sql" + most_popular: true + overview: + multi_instance: true + data_collection: + metrics_description: | + This collector monitors the health and performance of MySQL servers and collects general statistics, replication and user metrics. + method_description: | + It connects to the MySQL instance via a TCP or UNIX socket and executes the following commands: + + Executed queries: + + - `SELECT VERSION();` + - `SHOW GLOBAL STATUS;` + - `SHOW GLOBAL VARIABLES;` + - `SHOW SLAVE STATUS;` or `SHOW ALL SLAVES STATUS;` (MariaDBv10.2+) or `SHOW REPLICA STATUS;` (MySQL 8.0.22+) + - `SHOW USER_STATISTICS;` (MariaDBv10.1.1+) + - `SELECT TIME,USER FROM INFORMATION_SCHEMA.PROCESSLIST;` + default_behavior: + auto_detection: + description: | + By default, it detects instances running on localhost by trying to connect as root and netdata using known MySQL TCP and UNIX sockets: + + - /var/run/mysqld/mysqld.sock + - /var/run/mysqld/mysql.sock + - /var/lib/mysql/mysql.sock + - /tmp/mysql.sock + - 127.0.0.1:3306 + - "[::1]:3306" + limits: + description: "" + performance_impact: + description: "" + additional_permissions: + description: "" + supported_platforms: + include: [] + exclude: [] + setup: + prerequisites: + list: + - title: Create netdata user + description: | + A user account should have the + following [permissions](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html): + + - [`USAGE`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_usage) + - [`REPLICATION CLIENT`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_replication-client) + - [`PROCESS`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_process) + + To create the `netdata` user with these permissions, execute the following in the MySQL shell: + + ```mysql + CREATE USER 'netdata'@'localhost'; + GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost'; + FLUSH PRIVILEGES; + ``` + + The `netdata` user will have the ability to connect to the MySQL server on localhost without a password. It will only + be able to gather statistics without being able to alter or affect operations in any way. + configuration: + file: + name: go.d/mysql.conf + options: + description: | + The following options can be defined globally: update_every, autodetection_retry. + folding: + title: Config options + enabled: true + list: + - name: update_every + description: Data collection frequency. + default_value: 5 + required: false + - name: autodetection_retry + description: Recheck interval in seconds. Zero means no recheck will be scheduled. + default_value: 0 + required: false + - name: dsn + description: MySQL server DSN (Data Source Name). See [DSN syntax](https://github.com/go-sql-driver/mysql#dsn-data-source-name). + default_value: root@tcp(localhost:3306)/ + required: true + - name: my.cnf + description: Specifies the my.cnf file to read the connection settings from the [client] section. + default_value: "" + required: false + - name: timeout + description: Query timeout in seconds. + default_value: 1 + required: false + examples: + folding: + title: Config + enabled: true + list: + - name: TCP socket + description: An example configuration. + config: | + jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + - name: Unix socket + description: An example configuration. + config: | + jobs: + - name: local + dsn: netdata@unix(/var/lib/mysql/mysql.sock)/ + - name: Connection with password + description: An example configuration. + config: | + jobs: + - name: local + dsn: netconfig:password@tcp(127.0.0.1:3306)/ + - name: my.cnf + description: An example configuration. + config: | + jobs: + - name: local + my.cnf: '/etc/my.cnf' + - name: Multi-instance + description: | + > **Note**: When you define multiple jobs, their names must be unique. + + Local and remote instances. + config: | + jobs: + - name: local + dsn: netdata@tcp(127.0.0.1:3306)/ + + - name: remote + dsn: netconfig:password@tcp(203.0.113.0:3306)/ + troubleshooting: + problems: + list: [] + alerts: + - name: mysql_10s_slow_queries + metric: mysql.queries + info: number of slow queries in the last 10 seconds + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_10s_table_locks_immediate + metric: mysql.table_locks + info: number of table immediate locks in the last 10 seconds + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_10s_table_locks_waited + metric: mysql.table_locks + info: number of table waited locks in the last 10 seconds + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_10s_waited_locks_ratio + metric: mysql.table_locks + info: ratio of waited table locks over the last 10 seconds + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_connections + metric: mysql.connections_active + info: client connections utilization + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_replication + metric: mysql.slave_status + info: "replication status (0: stopped, 1: working)" + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_replication_lag + metric: mysql.slave_behind + info: difference between the timestamp of the latest transaction processed by the SQL thread and the timestamp of the same transaction when it was processed on the master + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_galera_cluster_size_max_2m + metric: mysql.galera_cluster_size + info: maximum galera cluster size in the last 2 minutes starting one minute ago + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_galera_cluster_size + metric: mysql.galera_cluster_size + info: current galera cluster size, compared to the maximum size in the last 2 minutes + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_galera_cluster_state_warn + metric: mysql.galera_cluster_state + info: galera node state is either Donor/Desynced or Joined + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_galera_cluster_state_crit + metric: mysql.galera_cluster_state + info: galera node state is either Undefined or Joining or Error + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + - name: mysql_galera_cluster_status + metric: mysql.galera_cluster_status + info: galera node is part of a nonoperational component. This occurs in cases of multiple membership changes that result in a loss of Quorum or in cases of split-brain situations. + link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf + metrics: + folding: + title: Metrics + enabled: false + description: "" + availability: + - MySQL + - MariaDB + - Percona + scopes: + - name: global + description: These metrics refer to the entire monitored application. + labels: [] + metrics: + - name: mysql.net + description: Bandwidth + unit: kilobits/s + chart_type: area + dimensions: + - name: in + - name: out + - name: mysql.queries + description: Queries + unit: queries/s + chart_type: line + dimensions: + - name: queries + - name: questions + - name: slow_queries + - name: mysql.queries_type + description: Queries By Type + unit: queries/s + chart_type: stacked + dimensions: + - name: select + - name: delete + - name: update + - name: insert + - name: replace + - name: mysql.handlers + description: Handlers + unit: handlers/s + chart_type: line + dimensions: + - name: commit + - name: delete + - name: prepare + - name: read_first + - name: read_key + - name: read_next + - name: read_prev + - name: read_rnd + - name: read_rnd_next + - name: rollback + - name: savepoint + - name: savepointrollback + - name: update + - name: write + - name: mysql.table_open_cache_overflows + description: Table open cache overflows + unit: overflows/s + chart_type: line + dimensions: + - name: open_cache + - name: mysql.table_locks + description: Table Locks + unit: locks/s + chart_type: line + dimensions: + - name: immediate + - name: waited + - name: mysql.join_issues + description: Table Select Join Issues + unit: joins/s + chart_type: line + dimensions: + - name: full_join + - name: full_range_join + - name: range + - name: range_check + - name: scan + - name: mysql.sort_issues + description: Table Sort Issues + unit: issues/s + chart_type: line + dimensions: + - name: merge_passes + - name: range + - name: scan + - name: mysql.tmp + description: Tmp Operations + unit: events/s + chart_type: line + dimensions: + - name: disk_tables + - name: files + - name: tables + - name: mysql.connections + description: Connections + unit: connections/s + chart_type: line + dimensions: + - name: all + - name: aborted + - name: mysql.connections_active + description: Active Connections + unit: connections + chart_type: line + dimensions: + - name: active + - name: limit + - name: max_active + - name: mysql.threads + description: Threads + unit: threads + chart_type: line + dimensions: + - name: connected + - name: cached + - name: running + - name: mysql.threads_created + description: Threads Creation Rate + unit: threads/s + chart_type: line + dimensions: + - name: created + - name: mysql.thread_cache_misses + description: Threads Cache Misses + unit: misses + chart_type: line + dimensions: + - name: misses + - name: mysql.innodb_io + description: InnoDB I/O Bandwidth + unit: KiB/s + chart_type: line + dimensions: + - name: read + - name: write + - name: mysql.innodb_io_ops + description: InnoDB I/O Operations + unit: operations/s + chart_type: line + dimensions: + - name: reads + - name: writes + - name: fsyncs + - name: mysql.innodb_io_pending_ops + description: InnoDB Pending I/O Operations + unit: operations + chart_type: line + dimensions: + - name: reads + - name: writes + - name: fsyncs + - name: mysql.innodb_log + description: InnoDB Log Operations + unit: operations/s + chart_type: line + dimensions: + - name: waits + - name: write_requests + - name: writes + - name: mysql.innodb_cur_row_lock + description: InnoDB Current Row Locks + unit: operations + chart_type: line + dimensions: + - name: current waits + - name: mysql.innodb_rows + description: InnoDB Row Operations + unit: operations/s + chart_type: area + dimensions: + - name: inserted + - name: read + - name: updated + - name: deleted + - name: mysql.innodb_buffer_pool_pages + description: InnoDB Buffer Pool Pages + unit: pages + chart_type: line + dimensions: + - name: data + - name: dirty + - name: free + - name: misc + - name: total + - name: mysql.innodb_buffer_pool_pages_flushed + description: InnoDB Buffer Pool Flush Pages Requests + unit: requests/s + chart_type: line + dimensions: + - name: flush_pages + - name: mysql.innodb_buffer_pool_bytes + description: InnoDB Buffer Pool Bytes + unit: MiB + chart_type: line + dimensions: + - name: data + - name: dirty + - name: mysql.innodb_buffer_pool_read_ahead + description: InnoDB Buffer Pool Read Pages + unit: pages/s + chart_type: line + dimensions: + - name: all + - name: evicted + - name: mysql.innodb_buffer_pool_read_ahead_rnd + description: InnoDB Buffer Pool Random Read-Aheads + unit: operations/s + chart_type: line + dimensions: + - name: read-ahead + - name: mysql.innodb_buffer_pool_ops + description: InnoDB Buffer Pool Operations + unit: operations/s + chart_type: area + dimensions: + - name: disk_reads + - name: wait_free + - name: mysql.innodb_os_log + description: InnoDB OS Log Pending Operations + unit: operations + chart_type: line + dimensions: + - name: fsyncs + - name: writes + - name: mysql.innodb_os_log_fsync_writes + description: InnoDB OS Log Operations + unit: operations/s + chart_type: line + dimensions: + - name: fsyncs + - name: mysql.innodb_os_log_io + description: InnoDB OS Log Bandwidth + unit: KiB/s + chart_type: area + dimensions: + - name: write + - name: mysql.innodb_deadlocks + description: InnoDB Deadlocks + unit: operations/s + chart_type: area + dimensions: + - name: deadlocks + - name: mysql.files + description: Open Files + unit: files + chart_type: line + dimensions: + - name: files + - name: mysql.files_rate + description: Opened Files Rate + unit: files/s + chart_type: line + dimensions: + - name: files + - name: mysql.connection_errors + description: Connection Errors + unit: errors/s + chart_type: line + dimensions: + - name: accept + - name: internal + - name: max + - name: peer_addr + - name: select + - name: tcpwrap + - name: mysql.opened_tables + description: Opened Tables + unit: tables/s + chart_type: line + dimensions: + - name: tables + - name: mysql.open_tables + description: Open Tables + unit: tables + chart_type: area + dimensions: + - name: cache + - name: tables + - name: mysql.process_list_fetch_query_duration + description: Process List Fetch Duration + unit: milliseconds + chart_type: line + dimensions: + - name: duration + - name: mysql.process_list_queries_count + description: Queries Count + unit: queries + chart_type: stacked + dimensions: + - name: system + - name: user + - name: mysql.process_list_longest_query_duration + description: Longest Query Duration + unit: seconds + chart_type: line + dimensions: + - name: duration + - name: mysql.qcache_ops + description: QCache Operations + unit: queries/s + chart_type: line + dimensions: + - name: hits + - name: lowmem_prunes + - name: inserts + - name: not_cached + - name: mysql.qcache + description: QCache Queries in Cache + unit: queries + chart_type: line + dimensions: + - name: queries + - name: mysql.qcache_freemem + description: QCache Free Memory + unit: MiB + chart_type: area + dimensions: + - name: free + - name: mysql.qcache_memblocks + description: QCache Memory Blocks + unit: blocks + chart_type: line + dimensions: + - name: free + - name: total + - name: mysql.galera_writesets + description: Replicated Writesets + unit: writesets/s + chart_type: line + dimensions: + - name: rx + - name: tx + - name: mysql.galera_bytes + description: Replicated Bytes + unit: KiB/s + chart_type: area + dimensions: + - name: rx + - name: tx + - name: mysql.galera_queue + description: Galera Queue + unit: writesets + chart_type: line + dimensions: + - name: rx + - name: tx + - name: mysql.galera_conflicts + description: Replication Conflicts + unit: transactions + chart_type: area + dimensions: + - name: bf_aborts + - name: cert_fails + - name: mysql.galera_flow_control + description: Flow Control + unit: ms + chart_type: area + dimensions: + - name: paused + - name: mysql.galera_cluster_status + description: Cluster Component Status + unit: status + chart_type: line + dimensions: + - name: primary + - name: non_primary + - name: disconnected + - name: mysql.galera_cluster_state + description: Cluster Component State + unit: state + chart_type: line + dimensions: + - name: undefined + - name: joining + - name: donor + - name: joined + - name: synced + - name: error + - name: mysql.galera_cluster_size + description: Number of Nodes in the Cluster + unit: nodes + chart_type: line + dimensions: + - name: nodes + - name: mysql.galera_cluster_weight + description: The Total Weight of the Current Members in the Cluster + unit: weight + chart_type: line + dimensions: + - name: weight + - name: mysql.galera_connected + description: Cluster Connection Status + unit: boolean + chart_type: line + dimensions: + - name: connected + - name: mysql.galera_ready + description: Accept Queries Readiness Status + unit: boolean + chart_type: line + dimensions: + - name: ready + - name: mysql.galera_open_transactions + description: Open Transactions + unit: transactions + chart_type: line + dimensions: + - name: open + - name: mysql.galera_thread_count + description: Total Number of WSRep (applier/rollbacker) Threads + unit: threads + chart_type: line + dimensions: + - name: threads + - name: mysql.key_blocks + description: MyISAM Key Cache Blocks + unit: blocks + chart_type: line + dimensions: + - name: unused + - name: used + - name: not_flushed + - name: mysql.key_requests + description: MyISAM Key Cache Requests + unit: requests/s + chart_type: area + dimensions: + - name: reads + - name: writes + - name: mysql.key_disk_ops + description: MyISAM Key Cache Disk Operations + unit: operations/s + chart_type: area + dimensions: + - name: reads + - name: writes + - name: mysql.binlog_cache + description: Binlog Cache + unit: transactions/s + chart_type: line + dimensions: + - name: disk + - name: all + - name: mysql.binlog_stmt_cache + description: Binlog Statement Cache + unit: statements/s + chart_type: line + dimensions: + - name: disk + - name: all + - name: connection + description: These metrics refer to the replication connection. + labels: [] + metrics: + - name: mysql.slave_behind + description: Slave Behind Seconds + unit: seconds + chart_type: line + dimensions: + - name: seconds + - name: mysql.slave_status + description: I/O / SQL Thread Running State + unit: boolean + chart_type: line + dimensions: + - name: sql_running + - name: io_running + - name: user + description: These metrics refer to the MySQL user. + labels: + - name: user + description: username + metrics: + - name: mysql.userstats_cpu + description: User CPU Time + unit: percentage + chart_type: line + availability: + - MariaDB + - Percona + dimensions: + - name: used + - name: mysql.userstats_rows + description: User Rows Operations + unit: operations/s + chart_type: stacked + availability: + - MariaDB + - Percona + dimensions: + - name: read + - name: sent + - name: updated + - name: inserted + - name: deleted + - name: mysql.userstats_commands + description: User Commands + unit: commands/s + chart_type: stacked + availability: + - MariaDB + - Percona + dimensions: + - name: select + - name: update + - name: other + - name: mysql.userstats_denied_commands + description: User Denied Commands + unit: commands/s + chart_type: stacked + availability: + - MariaDB + - Percona + dimensions: + - name: denied + - name: mysql.userstats_created_transactions + description: User Transactions + unit: transactions/s + chart_type: area + availability: + - MariaDB + - Percona + dimensions: + - name: commit + - name: rollback + - name: mysql.userstats_binlog_written + description: User Binlog Written + unit: B/s + chart_type: line + availability: + - MariaDB + - Percona + dimensions: + - name: written + - name: mysql.userstats_empty_queries + description: User Empty Queries + unit: queries/s + chart_type: line + availability: + - MariaDB + - Percona + dimensions: + - name: empty + - name: mysql.userstats_connections + description: User Created Connections + unit: connections/s + chart_type: line + availability: + - MariaDB + - Percona + dimensions: + - name: created + - name: mysql.userstats_lost_connections + description: User Lost Connections + unit: connections/s + chart_type: line + availability: + - MariaDB + - Percona + dimensions: + - name: lost + - name: mysql.userstats_denied_connections + description: User Denied Connections + unit: connections/s + chart_type: line + availability: + - MariaDB + - Percona + dimensions: + - name: denied + - <<: *module + meta: + <<: *meta + id: collector-go.d.plugin-mariadb + monitored_instance: + name: MariaDB + link: https://mariadb.org/ + icon_filename: mariadb.svg + categories: + - data-collection.database-servers + - <<: *module + meta: + <<: *meta + id: collector-go.d.plugin-percona_mysql + most_popular: false + monitored_instance: + name: Percona MySQL + link: https://www.percona.com/software/mysql-database/percona-server + icon_filename: percona.svg + categories: + - data-collection.database-servers diff --git a/src/go/collectors/go.d.plugin/modules/mysql/mycnf.go b/src/go/collectors/go.d.plugin/modules/mysql/mycnf.go new file mode 100644 index 000000000..2069af80d --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/mycnf.go @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "fmt" + "os" + + "gopkg.in/ini.v1" +) + +func dsnFromFile(filename string) (string, error) { + f, err := ini.Load(filename) + if err != nil { + return "", err + } + + section, err := f.GetSection("client") + if err != nil { + return "", err + } + + defaultUser := getUser() + defaultHost := "localhost" + defaultPort := "3306" + + user := section.Key("user").String() + password := section.Key("password").String() + socket := section.Key("socket").String() + host := section.Key("host").String() + port := section.Key("port").String() + database := section.Key("database").String() + + var dsn string + + if user != "" { + dsn = user + } else { + dsn = defaultUser + } + + if password != "" { + dsn += ":" + password + } + + switch { + case socket != "": + dsn += fmt.Sprintf("@unix(%s)/", socket) + case host != "" && port != "": + dsn += fmt.Sprintf("@tcp(%s:%s)/", host, port) + case host != "": + dsn += fmt.Sprintf("@tcp(%s:%s)/", host, defaultPort) + case port != "": + dsn += fmt.Sprintf("@tcp(%s:%s)/", defaultHost, port) + default: + dsn += "@/" + } + + if database != "" { + dsn += database + } + return dsn, nil +} + +func getUser() (user string) { + if user = os.Getenv("LOGNAME"); user != "" { + return user + } + if user = os.Getenv("USER"); user != "" { + return user + } + if user = os.Getenv("LNAME"); user != "" { + return user + } + if user = os.Getenv("USERNAME"); user != "" { + return user + } + return "" +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/mycnf_test.go b/src/go/collectors/go.d.plugin/modules/mysql/mycnf_test.go new file mode 100644 index 000000000..f68680272 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/mycnf_test.go @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func Test_dsnFromFile(t *testing.T) { + user := getUser() + tests := map[string]struct { + config string + expectedDSN string + wantErr bool + }{ + "socket": { + config: ` +[client] +socket=/opt/bitnami/mariadb/tmp/mysql.sock +`, + expectedDSN: user + "@unix(/opt/bitnami/mariadb/tmp/mysql.sock)/", + }, + "socket, host, port": { + config: ` +[client] +host=10.0.0.0 +port=3307 +socket=/opt/bitnami/mariadb/tmp/mysql.sock +`, + expectedDSN: user + "@unix(/opt/bitnami/mariadb/tmp/mysql.sock)/", + }, + "host, port": { + config: ` +[client] +host=10.0.0.0 +port=3307 +`, + expectedDSN: user + "@tcp(10.0.0.0:3307)/", + }, + "only host": { + config: ` +[client] +host=10.0.0.0 +`, + expectedDSN: user + "@tcp(10.0.0.0:3306)/", + }, + "only port": { + config: ` +[client] +port=3307 +`, + expectedDSN: user + "@tcp(localhost:3307)/", + }, + "user, password": { + config: ` +[client] +user=user +password=password +`, + expectedDSN: "user:password@/", + }, + "empty": { + config: ` +[client] +`, + expectedDSN: user + "@/", + }, + "no client section": { + config: ` +[no_client] +`, + wantErr: true, + }, + } + pattern := "netdata-godplugin-mysql-dsnFromFile-*" + dir, err := os.MkdirTemp(os.TempDir(), pattern) + require.NoError(t, err) + defer func() { _ = os.RemoveAll(dir) }() + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + f, err := os.CreateTemp(dir, name) + require.NoError(t, err) + _ = f.Close() + defer func() { _ = os.Remove(f.Name()) }() + _ = os.WriteFile(f.Name(), []byte(test.config), 0644) + + if dsn, err := dsnFromFile(f.Name()); test.wantErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, test.expectedDSN, dsn) + } + }) + } +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/mysql.go b/src/go/collectors/go.d.plugin/modules/mysql/mysql.go new file mode 100644 index 000000000..a73755b3a --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/mysql.go @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "database/sql" + _ "embed" + "errors" + "strings" + "sync" + "time" + + "github.com/netdata/netdata/go/go.d.plugin/agent/module" + "github.com/netdata/netdata/go/go.d.plugin/pkg/web" + + "github.com/blang/semver/v4" + "github.com/go-sql-driver/mysql" + _ "github.com/go-sql-driver/mysql" +) + +//go:embed "config_schema.json" +var configSchema string + +func init() { + module.Register("mysql", module.Creator{ + JobConfigSchema: configSchema, + Create: func() module.Module { return New() }, + }) +} + +func New() *MySQL { + return &MySQL{ + Config: Config{ + DSN: "root@tcp(localhost:3306)/", + Timeout: web.Duration(time.Second), + }, + + charts: baseCharts.Copy(), + addInnoDBOSLogOnce: &sync.Once{}, + addBinlogOnce: &sync.Once{}, + addMyISAMOnce: &sync.Once{}, + addInnodbDeadlocksOnce: &sync.Once{}, + addGaleraOnce: &sync.Once{}, + addQCacheOnce: &sync.Once{}, + addTableOpenCacheOverflowsOnce: &sync.Once{}, + doDisableSessionQueryLog: true, + doSlaveStatus: true, + doUserStatistics: true, + collectedReplConns: make(map[string]bool), + collectedUsers: make(map[string]bool), + + recheckGlobalVarsEvery: time.Minute * 10, + } +} + +type Config struct { + UpdateEvery int `yaml:"update_every" json:"update_every"` + DSN string `yaml:"dsn" json:"dsn"` + MyCNF string `yaml:"my.cnf" json:"my.cnf"` + Timeout web.Duration `yaml:"timeout" json:"timeout"` +} + +type MySQL struct { + module.Base + Config `yaml:",inline" json:""` + + charts *module.Charts + addInnoDBOSLogOnce *sync.Once + addBinlogOnce *sync.Once + addMyISAMOnce *sync.Once + addInnodbDeadlocksOnce *sync.Once + addGaleraOnce *sync.Once + addQCacheOnce *sync.Once + addTableOpenCacheOverflowsOnce *sync.Once + + db *sql.DB + + safeDSN string + version *semver.Version + isMariaDB bool + isPercona bool + + doDisableSessionQueryLog bool + + doSlaveStatus bool + collectedReplConns map[string]bool + doUserStatistics bool + collectedUsers map[string]bool + + recheckGlobalVarsTime time.Time + recheckGlobalVarsEvery time.Duration + varMaxConns int64 + varTableOpenCache int64 + varDisabledStorageEngine string + varLogBin string + varPerformanceSchema string +} + +func (m *MySQL) Configuration() any { + return m.Config +} + +func (m *MySQL) Init() error { + if m.MyCNF != "" { + dsn, err := dsnFromFile(m.MyCNF) + if err != nil { + m.Error(err) + return err + } + m.DSN = dsn + } + + if m.DSN == "" { + m.Error("dsn not set") + return errors.New("dsn not set") + } + + cfg, err := mysql.ParseDSN(m.DSN) + if err != nil { + m.Errorf("error on parsing DSN: %v", err) + return err + } + + cfg.Passwd = strings.Repeat("*", len(cfg.Passwd)) + m.safeDSN = cfg.FormatDSN() + + m.Debugf("using DSN [%s]", m.DSN) + + return nil +} + +func (m *MySQL) Check() error { + mx, err := m.collect() + if err != nil { + m.Error(err) + return err + } + if len(mx) == 0 { + return errors.New("no metrics collected") + } + return nil +} + +func (m *MySQL) Charts() *module.Charts { + return m.charts +} + +func (m *MySQL) Collect() map[string]int64 { + mx, err := m.collect() + if err != nil { + m.Error(err) + } + + if len(mx) == 0 { + return nil + } + return mx +} + +func (m *MySQL) Cleanup() { + if m.db == nil { + return + } + if err := m.db.Close(); err != nil { + m.Errorf("cleanup: error on closing the mysql database [%s]: %v", m.safeDSN, err) + } + m.db = nil +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/mysql_test.go b/src/go/collectors/go.d.plugin/modules/mysql/mysql_test.go new file mode 100644 index 000000000..da64507e4 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/mysql_test.go @@ -0,0 +1,1759 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package mysql + +import ( + "bufio" + "bytes" + "database/sql/driver" + "errors" + "fmt" + "os" + "strings" + "testing" + + "github.com/netdata/netdata/go/go.d.plugin/agent/module" + + "github.com/DATA-DOG/go-sqlmock" + "github.com/blang/semver/v4" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ( + dataConfigJSON, _ = os.ReadFile("testdata/config.json") + dataConfigYAML, _ = os.ReadFile("testdata/config.yaml") + + dataSessionVariables, _ = os.ReadFile("testdata/session_variables.txt") + + dataMySQLVer8030Version, _ = os.ReadFile("testdata/mysql/v8.0.30/version.txt") + dataMySQLVer8030GlobalStatus, _ = os.ReadFile("testdata/mysql/v8.0.30/global_status.txt") + dataMySQLVer8030GlobalVariables, _ = os.ReadFile("testdata/mysql/v8.0.30/global_variables.txt") + dataMySQLVer8030ReplicaStatusMultiSource, _ = os.ReadFile("testdata/mysql/v8.0.30/replica_status_multi_source.txt") + dataMySQLVer8030ProcessList, _ = os.ReadFile("testdata/mysql/v8.0.30/process_list.txt") + + dataPerconaVer8029Version, _ = os.ReadFile("testdata/percona/v8.0.29/version.txt") + dataPerconaVer8029GlobalStatus, _ = os.ReadFile("testdata/percona/v8.0.29/global_status.txt") + dataPerconaVer8029GlobalVariables, _ = os.ReadFile("testdata/percona/v8.0.29/global_variables.txt") + dataPerconaVer8029UserStatistics, _ = os.ReadFile("testdata/percona/v8.0.29/user_statistics.txt") + dataPerconaV8029ProcessList, _ = os.ReadFile("testdata/percona/v8.0.29/process_list.txt") + + dataMariaVer5564Version, _ = os.ReadFile("testdata/mariadb/v5.5.64/version.txt") + dataMariaVer5564GlobalStatus, _ = os.ReadFile("testdata/mariadb/v5.5.64/global_status.txt") + dataMariaVer5564GlobalVariables, _ = os.ReadFile("testdata/mariadb/v5.5.64/global_variables.txt") + dataMariaVer5564ProcessList, _ = os.ReadFile("testdata/mariadb/v5.5.64/process_list.txt") + + dataMariaVer1084Version, _ = os.ReadFile("testdata/mariadb/v10.8.4/version.txt") + dataMariaVer1084GlobalStatus, _ = os.ReadFile("testdata/mariadb/v10.8.4/global_status.txt") + dataMariaVer1084GlobalVariables, _ = os.ReadFile("testdata/mariadb/v10.8.4/global_variables.txt") + dataMariaVer1084AllSlavesStatusSingleSource, _ = os.ReadFile("testdata/mariadb/v10.8.4/all_slaves_status_single_source.txt") + dataMariaVer1084AllSlavesStatusMultiSource, _ = os.ReadFile("testdata/mariadb/v10.8.4/all_slaves_status_multi_source.txt") + dataMariaVer1084UserStatistics, _ = os.ReadFile("testdata/mariadb/v10.8.4/user_statistics.txt") + dataMariaVer1084ProcessList, _ = os.ReadFile("testdata/mariadb/v10.8.4/process_list.txt") + + dataMariaGaleraClusterVer1084Version, _ = os.ReadFile("testdata/mariadb/v10.8.4-galera-cluster/version.txt") + dataMariaGaleraClusterVer1084GlobalStatus, _ = os.ReadFile("testdata/mariadb/v10.8.4-galera-cluster/global_status.txt") + dataMariaGaleraClusterVer1084GlobalVariables, _ = os.ReadFile("testdata/mariadb/v10.8.4-galera-cluster/global_variables.txt") + dataMariaGaleraClusterVer1084UserStatistics, _ = os.ReadFile("testdata/mariadb/v10.8.4-galera-cluster/user_statistics.txt") + dataMariaGaleraClusterVer1084ProcessList, _ = os.ReadFile("testdata/mariadb/v10.8.4-galera-cluster/process_list.txt") +) + +func Test_testDataIsValid(t *testing.T) { + for name, data := range map[string][]byte{ + "dataConfigJSON": dataConfigJSON, + "dataConfigYAML": dataConfigYAML, + "dataSessionVariables": dataSessionVariables, + "dataMySQLVer8030Version": dataMySQLVer8030Version, + "dataMySQLVer8030GlobalStatus": dataMySQLVer8030GlobalStatus, + "dataMySQLVer8030GlobalVariables": dataMySQLVer8030GlobalVariables, + "dataMySQLVer8030ReplicaStatusMultiSource": dataMySQLVer8030ReplicaStatusMultiSource, + "dataMySQLVer8030ProcessList": dataMySQLVer8030ProcessList, + "dataPerconaVer8029Version": dataPerconaVer8029Version, + "dataPerconaVer8029GlobalStatus": dataPerconaVer8029GlobalStatus, + "dataPerconaVer8029GlobalVariables": dataPerconaVer8029GlobalVariables, + "dataPerconaVer8029UserStatistics": dataPerconaVer8029UserStatistics, + "dataPerconaV8029ProcessList": dataPerconaV8029ProcessList, + "dataMariaVer5564Version": dataMariaVer5564Version, + "dataMariaVer5564GlobalStatus": dataMariaVer5564GlobalStatus, + "dataMariaVer5564GlobalVariables": dataMariaVer5564GlobalVariables, + "dataMariaVer5564ProcessList": dataMariaVer5564ProcessList, + "dataMariaVer1084Version": dataMariaVer1084Version, + "dataMariaVer1084GlobalStatus": dataMariaVer1084GlobalStatus, + "dataMariaVer1084GlobalVariables": dataMariaVer1084GlobalVariables, + "dataMariaVer1084AllSlavesStatusSingleSource": dataMariaVer1084AllSlavesStatusSingleSource, + "dataMariaVer1084AllSlavesStatusMultiSource": dataMariaVer1084AllSlavesStatusMultiSource, + "dataMariaVer1084UserStatistics": dataMariaVer1084UserStatistics, + "dataMariaVer1084ProcessList": dataMariaVer1084ProcessList, + "dataMariaGaleraClusterVer1084Version": dataMariaGaleraClusterVer1084Version, + "dataMariaGaleraClusterVer1084GlobalStatus": dataMariaGaleraClusterVer1084GlobalStatus, + "dataMariaGaleraClusterVer1084GlobalVariables": dataMariaGaleraClusterVer1084GlobalVariables, + "dataMariaGaleraClusterVer1084UserStatistics": dataMariaGaleraClusterVer1084UserStatistics, + "dataMariaGaleraClusterVer1084ProcessList": dataMariaGaleraClusterVer1084ProcessList, + } { + require.NotNil(t, data, fmt.Sprintf("read data: %s", name)) + _, err := prepareMockRows(data) + require.NoError(t, err, fmt.Sprintf("prepare mock rows: %s", name)) + } +} + +func TestMySQL_ConfigurationSerialize(t *testing.T) { + module.TestConfigurationSerialize(t, &MySQL{}, dataConfigJSON, dataConfigYAML) +} + +func TestMySQL_Init(t *testing.T) { + tests := map[string]struct { + config Config + wantFail bool + }{ + "empty DSN": { + config: Config{DSN: ""}, + wantFail: true, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + mySQL := New() + mySQL.Config = test.config + + if test.wantFail { + assert.Error(t, mySQL.Init()) + } else { + assert.NoError(t, mySQL.Init()) + } + }) + } +} + +func TestMySQL_Cleanup(t *testing.T) { + tests := map[string]func(t *testing.T) (mySQL *MySQL, cleanup func()){ + "db connection not initialized": func(t *testing.T) (mySQL *MySQL, cleanup func()) { + return New(), func() {} + }, + "db connection initialized": func(t *testing.T) (mySQL *MySQL, cleanup func()) { + db, mock, err := sqlmock.New() + require.NoError(t, err) + + mock.ExpectClose() + mySQL = New() + mySQL.db = db + cleanup = func() { _ = db.Close() } + + return mySQL, cleanup + }, + } + + for name, prepare := range tests { + t.Run(name, func(t *testing.T) { + mySQL, cleanup := prepare(t) + defer cleanup() + + assert.NotPanics(t, mySQL.Cleanup) + assert.Nil(t, mySQL.db) + }) + } +} + +func TestMySQL_Charts(t *testing.T) { + assert.NotNil(t, New().Charts()) +} + +func TestMySQL_Check(t *testing.T) { + tests := map[string]struct { + prepareMock func(t *testing.T, m sqlmock.Sqlmock) + wantFail bool + }{ + "success on all queries": { + wantFail: false, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, dataMariaVer1084AllSlavesStatusMultiSource) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + }, + "fails when error on querying version": { + wantFail: true, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpectErr(m, queryShowVersion) + }, + }, + "fails when error on querying global status": { + wantFail: true, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpectErr(m, queryShowGlobalStatus) + }, + }, + "fails when error on querying global variables": { + wantFail: true, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpectErr(m, queryShowGlobalStatus) + }, + }, + "success when error on querying slave status": { + wantFail: false, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpectErr(m, queryShowAllSlavesStatus) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + }, + "success when error on querying user statistics": { + wantFail: false, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, dataMariaVer1084AllSlavesStatusMultiSource) + mockExpectErr(m, queryShowUserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + }, + "success when error on querying process list": { + wantFail: false, + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, dataMariaVer1084AllSlavesStatusMultiSource) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpectErr(m, queryShowProcessList) + }, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + db, mock, err := sqlmock.New( + sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual), + ) + require.NoError(t, err) + my := New() + my.db = db + defer func() { _ = db.Close() }() + + require.NoError(t, my.Init()) + + test.prepareMock(t, mock) + + if test.wantFail { + assert.Error(t, my.Check()) + } else { + assert.NoError(t, my.Check()) + } + assert.NoError(t, mock.ExpectationsWereMet()) + }) + } +} + +func TestMySQL_Collect(t *testing.T) { + type testCaseStep struct { + prepareMock func(t *testing.T, m sqlmock.Sqlmock) + check func(t *testing.T, my *MySQL) + } + tests := map[string][]testCaseStep{ + "MariaDB-Standalone[v5.5.46]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer5564Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer5564GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer5564GlobalVariables) + mockExpect(t, m, queryShowSlaveStatus, nil) + mockExpect(t, m, queryShowProcessList, dataMariaVer5564ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 0, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 639, + "bytes_sent": 41620, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 4, + "com_update": 0, + "connections": 4, + "created_tmp_disk_tables": 0, + "created_tmp_files": 6, + "created_tmp_tables": 5, + "handler_commit": 0, + "handler_delete": 0, + "handler_prepare": 0, + "handler_read_first": 0, + "handler_read_key": 0, + "handler_read_next": 0, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 1264, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 0, + "handler_write": 0, + "innodb_buffer_pool_bytes_data": 2342912, + "innodb_buffer_pool_bytes_dirty": 0, + "innodb_buffer_pool_pages_data": 143, + "innodb_buffer_pool_pages_dirty": 0, + "innodb_buffer_pool_pages_flushed": 0, + "innodb_buffer_pool_pages_free": 16240, + "innodb_buffer_pool_pages_misc": 0, + "innodb_buffer_pool_pages_total": 16383, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 459, + "innodb_buffer_pool_reads": 144, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 0, + "innodb_data_fsyncs": 3, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 4542976, + "innodb_data_reads": 155, + "innodb_data_writes": 3, + "innodb_data_written": 1536, + "innodb_deadlocks": 0, + "innodb_log_waits": 0, + "innodb_log_write_requests": 0, + "innodb_log_writes": 1, + "innodb_os_log_fsyncs": 3, + "innodb_os_log_pending_fsyncs": 0, + "innodb_os_log_pending_writes": 0, + "innodb_os_log_written": 512, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 107171, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 100, + "max_used_connections": 1, + "open_files": 21, + "open_tables": 26, + "opened_files": 84, + "opened_tables": 0, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "qcache_free_blocks": 1, + "qcache_free_memory": 67091120, + "qcache_hits": 0, + "qcache_inserts": 0, + "qcache_lowmem_prunes": 0, + "qcache_not_cached": 4, + "qcache_queries_in_cache": 0, + "qcache_total_blocks": 1, + "queries": 12, + "questions": 11, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 5, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 36, + "table_locks_waited": 0, + "table_open_cache": 400, + "thread_cache_misses": 2500, + "threads_cached": 0, + "threads_connected": 1, + "threads_created": 1, + "threads_running": 1, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "MariaDB-Standalone[v10.8.4]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, nil) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + + "aborted_connects": 2, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 81392, + "bytes_sent": 56794, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 6, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 12, + "created_tmp_disk_tables": 0, + "created_tmp_files": 5, + "created_tmp_tables": 2, + "handler_commit": 30, + "handler_delete": 0, + "handler_prepare": 0, + "handler_read_first": 7, + "handler_read_key": 7, + "handler_read_next": 3, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 626, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 3, + "handler_write": 13, + "innodb_buffer_pool_bytes_data": 5062656, + "innodb_buffer_pool_bytes_dirty": 475136, + "innodb_buffer_pool_pages_data": 309, + "innodb_buffer_pool_pages_dirty": 29, + "innodb_buffer_pool_pages_flushed": 0, + "innodb_buffer_pool_pages_free": 7755, + "innodb_buffer_pool_pages_misc": 0, + "innodb_buffer_pool_pages_total": 8064, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 1911, + "innodb_buffer_pool_reads": 171, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 148, + "innodb_data_fsyncs": 17, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 2801664, + "innodb_data_reads": 185, + "innodb_data_writes": 16, + "innodb_data_written": 0, + "innodb_deadlocks": 0, + "innodb_log_waits": 0, + "innodb_log_write_requests": 109, + "innodb_log_writes": 15, + "innodb_os_log_written": 6097, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 107163, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 1, + "open_files": 29, + "open_tables": 10, + "opened_files": 100, + "opened_tables": 16, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "qcache_free_blocks": 1, + "qcache_free_memory": 1031272, + "qcache_hits": 0, + "qcache_inserts": 0, + "qcache_lowmem_prunes": 0, + "qcache_not_cached": 0, + "qcache_queries_in_cache": 0, + "qcache_total_blocks": 1, + "queries": 33, + "questions": 24, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 2, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 60, + "table_locks_waited": 0, + "table_open_cache": 2000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 1666, + "threads_cached": 0, + "threads_connected": 1, + "threads_created": 2, + "threads_running": 3, + "userstats_netdata_access_denied": 33, + "userstats_netdata_binlog_bytes_written": 0, + "userstats_netdata_commit_transactions": 0, + "userstats_netdata_cpu_time": 77, + "userstats_netdata_denied_connections": 49698, + "userstats_netdata_empty_queries": 66, + "userstats_netdata_lost_connections": 0, + "userstats_netdata_other_commands": 0, + "userstats_netdata_rollback_transactions": 0, + "userstats_netdata_rows_deleted": 0, + "userstats_netdata_rows_inserted": 0, + "userstats_netdata_rows_read": 0, + "userstats_netdata_rows_sent": 99, + "userstats_netdata_rows_updated": 0, + "userstats_netdata_select_commands": 33, + "userstats_netdata_total_connections": 1, + "userstats_netdata_update_commands": 0, + "userstats_root_access_denied": 0, + "userstats_root_binlog_bytes_written": 0, + "userstats_root_commit_transactions": 0, + "userstats_root_cpu_time": 0, + "userstats_root_denied_connections": 0, + "userstats_root_empty_queries": 0, + "userstats_root_lost_connections": 0, + "userstats_root_other_commands": 0, + "userstats_root_rollback_transactions": 0, + "userstats_root_rows_deleted": 0, + "userstats_root_rows_inserted": 0, + "userstats_root_rows_read": 0, + "userstats_root_rows_sent": 2, + "userstats_root_rows_updated": 0, + "userstats_root_select_commands": 0, + "userstats_root_total_connections": 1, + "userstats_root_update_commands": 0, + "wsrep_cluster_size": 0, + "wsrep_cluster_status_disconnected": 1, + "wsrep_cluster_status_non_primary": 0, + "wsrep_cluster_status_primary": 0, + "wsrep_connected": 0, + "wsrep_local_bf_aborts": 0, + "wsrep_ready": 0, + "wsrep_thread_count": 0, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "MariaDB-SingleSourceReplication[v10.8.4]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, dataMariaVer1084AllSlavesStatusSingleSource) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 2, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 81392, + "bytes_sent": 56794, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 6, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 12, + "created_tmp_disk_tables": 0, + "created_tmp_files": 5, + "created_tmp_tables": 2, + "handler_commit": 30, + "handler_delete": 0, + "handler_prepare": 0, + "handler_read_first": 7, + "handler_read_key": 7, + "handler_read_next": 3, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 626, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 3, + "handler_write": 13, + "innodb_buffer_pool_bytes_data": 5062656, + "innodb_buffer_pool_bytes_dirty": 475136, + "innodb_buffer_pool_pages_data": 309, + "innodb_buffer_pool_pages_dirty": 29, + "innodb_buffer_pool_pages_flushed": 0, + "innodb_buffer_pool_pages_free": 7755, + "innodb_buffer_pool_pages_misc": 0, + "innodb_buffer_pool_pages_total": 8064, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 1911, + "innodb_buffer_pool_reads": 171, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 148, + "innodb_data_fsyncs": 17, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 2801664, + "innodb_data_reads": 185, + "innodb_data_writes": 16, + "innodb_data_written": 0, + "innodb_deadlocks": 0, + "innodb_log_waits": 0, + "innodb_log_write_requests": 109, + "innodb_log_writes": 15, + "innodb_os_log_written": 6097, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 107163, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 1, + "open_files": 29, + "open_tables": 10, + "opened_files": 100, + "opened_tables": 16, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "qcache_free_blocks": 1, + "qcache_free_memory": 1031272, + "qcache_hits": 0, + "qcache_inserts": 0, + "qcache_lowmem_prunes": 0, + "qcache_not_cached": 0, + "qcache_queries_in_cache": 0, + "qcache_total_blocks": 1, + "queries": 33, + "questions": 24, + "seconds_behind_master": 0, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 2, + "slave_io_running": 1, + "slave_sql_running": 1, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 60, + "table_locks_waited": 0, + "table_open_cache": 2000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 1666, + "threads_cached": 0, + "threads_connected": 1, + "threads_created": 2, + "threads_running": 3, + "userstats_netdata_access_denied": 33, + "userstats_netdata_binlog_bytes_written": 0, + "userstats_netdata_commit_transactions": 0, + "userstats_netdata_cpu_time": 77, + "userstats_netdata_denied_connections": 49698, + "userstats_netdata_empty_queries": 66, + "userstats_netdata_lost_connections": 0, + "userstats_netdata_other_commands": 0, + "userstats_netdata_rollback_transactions": 0, + "userstats_netdata_rows_deleted": 0, + "userstats_netdata_rows_inserted": 0, + "userstats_netdata_rows_read": 0, + "userstats_netdata_rows_sent": 99, + "userstats_netdata_rows_updated": 0, + "userstats_netdata_select_commands": 33, + "userstats_netdata_total_connections": 1, + "userstats_netdata_update_commands": 0, + "userstats_root_access_denied": 0, + "userstats_root_binlog_bytes_written": 0, + "userstats_root_commit_transactions": 0, + "userstats_root_cpu_time": 0, + "userstats_root_denied_connections": 0, + "userstats_root_empty_queries": 0, + "userstats_root_lost_connections": 0, + "userstats_root_other_commands": 0, + "userstats_root_rollback_transactions": 0, + "userstats_root_rows_deleted": 0, + "userstats_root_rows_inserted": 0, + "userstats_root_rows_read": 0, + "userstats_root_rows_sent": 2, + "userstats_root_rows_updated": 0, + "userstats_root_select_commands": 0, + "userstats_root_total_connections": 1, + "userstats_root_update_commands": 0, + "wsrep_cluster_size": 0, + "wsrep_cluster_status_disconnected": 1, + "wsrep_cluster_status_non_primary": 0, + "wsrep_cluster_status_primary": 0, + "wsrep_connected": 0, + "wsrep_local_bf_aborts": 0, + "wsrep_ready": 0, + "wsrep_thread_count": 0, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "MariaDB-MultiSourceReplication[v10.8.4]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, dataMariaVer1084AllSlavesStatusMultiSource) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 2, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 81392, + "bytes_sent": 56794, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 6, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 12, + "created_tmp_disk_tables": 0, + "created_tmp_files": 5, + "created_tmp_tables": 2, + "handler_commit": 30, + "handler_delete": 0, + "handler_prepare": 0, + "handler_read_first": 7, + "handler_read_key": 7, + "handler_read_next": 3, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 626, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 3, + "handler_write": 13, + "innodb_buffer_pool_bytes_data": 5062656, + "innodb_buffer_pool_bytes_dirty": 475136, + "innodb_buffer_pool_pages_data": 309, + "innodb_buffer_pool_pages_dirty": 29, + "innodb_buffer_pool_pages_flushed": 0, + "innodb_buffer_pool_pages_free": 7755, + "innodb_buffer_pool_pages_misc": 0, + "innodb_buffer_pool_pages_total": 8064, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 1911, + "innodb_buffer_pool_reads": 171, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 148, + "innodb_data_fsyncs": 17, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 2801664, + "innodb_data_reads": 185, + "innodb_data_writes": 16, + "innodb_data_written": 0, + "innodb_deadlocks": 0, + "innodb_log_waits": 0, + "innodb_log_write_requests": 109, + "innodb_log_writes": 15, + "innodb_os_log_written": 6097, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 107163, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 1, + "open_files": 29, + "open_tables": 10, + "opened_files": 100, + "opened_tables": 16, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "qcache_free_blocks": 1, + "qcache_free_memory": 1031272, + "qcache_hits": 0, + "qcache_inserts": 0, + "qcache_lowmem_prunes": 0, + "qcache_not_cached": 0, + "qcache_queries_in_cache": 0, + "qcache_total_blocks": 1, + "queries": 33, + "questions": 24, + "seconds_behind_master_master1": 0, + "seconds_behind_master_master2": 0, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 2, + "slave_io_running_master1": 1, + "slave_io_running_master2": 1, + "slave_sql_running_master1": 1, + "slave_sql_running_master2": 1, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 60, + "table_locks_waited": 0, + "table_open_cache": 2000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 1666, + "threads_cached": 0, + "threads_connected": 1, + "threads_created": 2, + "threads_running": 3, + "userstats_netdata_access_denied": 33, + "userstats_netdata_binlog_bytes_written": 0, + "userstats_netdata_commit_transactions": 0, + "userstats_netdata_cpu_time": 77, + "userstats_netdata_denied_connections": 49698, + "userstats_netdata_empty_queries": 66, + "userstats_netdata_lost_connections": 0, + "userstats_netdata_other_commands": 0, + "userstats_netdata_rollback_transactions": 0, + "userstats_netdata_rows_deleted": 0, + "userstats_netdata_rows_inserted": 0, + "userstats_netdata_rows_read": 0, + "userstats_netdata_rows_sent": 99, + "userstats_netdata_rows_updated": 0, + "userstats_netdata_select_commands": 33, + "userstats_netdata_total_connections": 1, + "userstats_netdata_update_commands": 0, + "userstats_root_access_denied": 0, + "userstats_root_binlog_bytes_written": 0, + "userstats_root_commit_transactions": 0, + "userstats_root_cpu_time": 0, + "userstats_root_denied_connections": 0, + "userstats_root_empty_queries": 0, + "userstats_root_lost_connections": 0, + "userstats_root_other_commands": 0, + "userstats_root_rollback_transactions": 0, + "userstats_root_rows_deleted": 0, + "userstats_root_rows_inserted": 0, + "userstats_root_rows_read": 0, + "userstats_root_rows_sent": 2, + "userstats_root_rows_updated": 0, + "userstats_root_select_commands": 0, + "userstats_root_total_connections": 1, + "userstats_root_update_commands": 0, + "wsrep_cluster_size": 0, + "wsrep_cluster_status_disconnected": 1, + "wsrep_cluster_status_non_primary": 0, + "wsrep_cluster_status_primary": 0, + "wsrep_connected": 0, + "wsrep_local_bf_aborts": 0, + "wsrep_ready": 0, + "wsrep_thread_count": 0, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "MariaDB-MultiSourceReplication[v10.8.4]: error on slaves status (no permissions)": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaVer1084GlobalVariables) + mockExpectErr(m, queryShowAllSlavesStatus) + mockExpect(t, m, queryShowUserStatistics, dataMariaVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaVer1084ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 2, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 81392, + "bytes_sent": 56794, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 6, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 12, + "created_tmp_disk_tables": 0, + "created_tmp_files": 5, + "created_tmp_tables": 2, + "handler_commit": 30, + "handler_delete": 0, + "handler_prepare": 0, + "handler_read_first": 7, + "handler_read_key": 7, + "handler_read_next": 3, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 626, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 3, + "handler_write": 13, + "innodb_buffer_pool_bytes_data": 5062656, + "innodb_buffer_pool_bytes_dirty": 475136, + "innodb_buffer_pool_pages_data": 309, + "innodb_buffer_pool_pages_dirty": 29, + "innodb_buffer_pool_pages_flushed": 0, + "innodb_buffer_pool_pages_free": 7755, + "innodb_buffer_pool_pages_misc": 0, + "innodb_buffer_pool_pages_total": 8064, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 1911, + "innodb_buffer_pool_reads": 171, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 148, + "innodb_data_fsyncs": 17, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 2801664, + "innodb_data_reads": 185, + "innodb_data_writes": 16, + "innodb_data_written": 0, + "innodb_deadlocks": 0, + "innodb_log_waits": 0, + "innodb_log_write_requests": 109, + "innodb_log_writes": 15, + "innodb_os_log_written": 6097, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 107163, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 1, + "open_files": 29, + "open_tables": 10, + "opened_files": 100, + "opened_tables": 16, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "qcache_free_blocks": 1, + "qcache_free_memory": 1031272, + "qcache_hits": 0, + "qcache_inserts": 0, + "qcache_lowmem_prunes": 0, + "qcache_not_cached": 0, + "qcache_queries_in_cache": 0, + "qcache_total_blocks": 1, + "queries": 33, + "questions": 24, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 2, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 60, + "table_locks_waited": 0, + "table_open_cache": 2000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 1666, + "threads_cached": 0, + "threads_connected": 1, + "threads_created": 2, + "threads_running": 3, + "userstats_netdata_access_denied": 33, + "userstats_netdata_binlog_bytes_written": 0, + "userstats_netdata_commit_transactions": 0, + "userstats_netdata_cpu_time": 77, + "userstats_netdata_denied_connections": 49698, + "userstats_netdata_empty_queries": 66, + "userstats_netdata_lost_connections": 0, + "userstats_netdata_other_commands": 0, + "userstats_netdata_rollback_transactions": 0, + "userstats_netdata_rows_deleted": 0, + "userstats_netdata_rows_inserted": 0, + "userstats_netdata_rows_read": 0, + "userstats_netdata_rows_sent": 99, + "userstats_netdata_rows_updated": 0, + "userstats_netdata_select_commands": 33, + "userstats_netdata_total_connections": 1, + "userstats_netdata_update_commands": 0, + "userstats_root_access_denied": 0, + "userstats_root_binlog_bytes_written": 0, + "userstats_root_commit_transactions": 0, + "userstats_root_cpu_time": 0, + "userstats_root_denied_connections": 0, + "userstats_root_empty_queries": 0, + "userstats_root_lost_connections": 0, + "userstats_root_other_commands": 0, + "userstats_root_rollback_transactions": 0, + "userstats_root_rows_deleted": 0, + "userstats_root_rows_inserted": 0, + "userstats_root_rows_read": 0, + "userstats_root_rows_sent": 2, + "userstats_root_rows_updated": 0, + "userstats_root_select_commands": 0, + "userstats_root_total_connections": 1, + "userstats_root_update_commands": 0, + "wsrep_cluster_size": 0, + "wsrep_cluster_status_disconnected": 1, + "wsrep_cluster_status_non_primary": 0, + "wsrep_cluster_status_primary": 0, + "wsrep_connected": 0, + "wsrep_local_bf_aborts": 0, + "wsrep_ready": 0, + "wsrep_thread_count": 0, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "MariaDB-GaleraCluster[v10.8.4]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMariaGaleraClusterVer1084Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMariaGaleraClusterVer1084GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMariaGaleraClusterVer1084GlobalVariables) + mockExpect(t, m, queryShowAllSlavesStatus, nil) + mockExpect(t, m, queryShowUserStatistics, dataMariaGaleraClusterVer1084UserStatistics) + mockExpect(t, m, queryShowProcessList, dataMariaGaleraClusterVer1084ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 0, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 3009, + "bytes_sent": 228856, + "com_delete": 6, + "com_insert": 0, + "com_replace": 0, + "com_select": 12, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 15, + "created_tmp_disk_tables": 4, + "created_tmp_files": 5, + "created_tmp_tables": 17, + "handler_commit": 37, + "handler_delete": 7, + "handler_prepare": 0, + "handler_read_first": 3, + "handler_read_key": 9, + "handler_read_next": 1, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 6222, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 0, + "handler_write": 9, + "innodb_buffer_pool_bytes_data": 5193728, + "innodb_buffer_pool_bytes_dirty": 2260992, + "innodb_buffer_pool_pages_data": 317, + "innodb_buffer_pool_pages_dirty": 138, + "innodb_buffer_pool_pages_flushed": 0, + "innodb_buffer_pool_pages_free": 7747, + "innodb_buffer_pool_pages_misc": 0, + "innodb_buffer_pool_pages_total": 8064, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 2298, + "innodb_buffer_pool_reads": 184, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 203, + "innodb_data_fsyncs": 15, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 3014656, + "innodb_data_reads": 201, + "innodb_data_writes": 14, + "innodb_data_written": 0, + "innodb_deadlocks": 0, + "innodb_log_waits": 0, + "innodb_log_write_requests": 65, + "innodb_log_writes": 13, + "innodb_os_log_written": 4785, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 107163, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 1, + "open_files": 7, + "open_tables": 0, + "opened_files": 125, + "opened_tables": 24, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "qcache_free_blocks": 1, + "qcache_free_memory": 1031272, + "qcache_hits": 0, + "qcache_inserts": 0, + "qcache_lowmem_prunes": 0, + "qcache_not_cached": 0, + "qcache_queries_in_cache": 0, + "qcache_total_blocks": 1, + "queries": 75, + "questions": 62, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 17, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 17, + "table_locks_waited": 0, + "table_open_cache": 2000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 4000, + "threads_cached": 0, + "threads_connected": 1, + "threads_created": 6, + "threads_running": 1, + "userstats_netdata_access_denied": 33, + "userstats_netdata_binlog_bytes_written": 0, + "userstats_netdata_commit_transactions": 0, + "userstats_netdata_cpu_time": 77, + "userstats_netdata_denied_connections": 49698, + "userstats_netdata_empty_queries": 66, + "userstats_netdata_lost_connections": 0, + "userstats_netdata_other_commands": 0, + "userstats_netdata_rollback_transactions": 0, + "userstats_netdata_rows_deleted": 0, + "userstats_netdata_rows_inserted": 0, + "userstats_netdata_rows_read": 0, + "userstats_netdata_rows_sent": 99, + "userstats_netdata_rows_updated": 0, + "userstats_netdata_select_commands": 33, + "userstats_netdata_total_connections": 1, + "userstats_netdata_update_commands": 0, + "userstats_root_access_denied": 0, + "userstats_root_binlog_bytes_written": 0, + "userstats_root_commit_transactions": 0, + "userstats_root_cpu_time": 0, + "userstats_root_denied_connections": 0, + "userstats_root_empty_queries": 0, + "userstats_root_lost_connections": 0, + "userstats_root_other_commands": 0, + "userstats_root_rollback_transactions": 0, + "userstats_root_rows_deleted": 0, + "userstats_root_rows_inserted": 0, + "userstats_root_rows_read": 0, + "userstats_root_rows_sent": 2, + "userstats_root_rows_updated": 0, + "userstats_root_select_commands": 0, + "userstats_root_total_connections": 1, + "userstats_root_update_commands": 0, + "wsrep_cluster_size": 3, + "wsrep_cluster_status_disconnected": 0, + "wsrep_cluster_status_non_primary": 0, + "wsrep_cluster_status_primary": 1, + "wsrep_cluster_weight": 3, + "wsrep_connected": 1, + "wsrep_flow_control_paused_ns": 0, + "wsrep_local_bf_aborts": 0, + "wsrep_local_cert_failures": 0, + "wsrep_local_recv_queue": 0, + "wsrep_local_send_queue": 0, + "wsrep_local_state_donor": 0, + "wsrep_local_state_error": 0, + "wsrep_local_state_joined": 0, + "wsrep_local_state_joiner": 0, + "wsrep_local_state_synced": 1, + "wsrep_local_state_undefined": 0, + "wsrep_open_transactions": 0, + "wsrep_ready": 1, + "wsrep_received": 11, + "wsrep_received_bytes": 1410, + "wsrep_replicated": 0, + "wsrep_replicated_bytes": 0, + "wsrep_thread_count": 5, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "MySQL-MultiSourceReplication[v8.0.30]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataMySQLVer8030Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataMySQLVer8030GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataMySQLVer8030GlobalVariables) + mockExpect(t, m, queryShowReplicaStatus, dataMySQLVer8030ReplicaStatusMultiSource) + mockExpect(t, m, queryShowProcessListPS, dataMySQLVer8030ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 0, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 6, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 5584, + "bytes_sent": 70700, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 2, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 25, + "created_tmp_disk_tables": 0, + "created_tmp_files": 5, + "created_tmp_tables": 6, + "handler_commit": 720, + "handler_delete": 8, + "handler_prepare": 24, + "handler_read_first": 50, + "handler_read_key": 1914, + "handler_read_next": 4303, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 4723, + "handler_rollback": 1, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 373, + "handler_write": 1966, + "innodb_buffer_pool_bytes_data": 17121280, + "innodb_buffer_pool_bytes_dirty": 0, + "innodb_buffer_pool_pages_data": 1045, + "innodb_buffer_pool_pages_dirty": 0, + "innodb_buffer_pool_pages_flushed": 361, + "innodb_buffer_pool_pages_free": 7143, + "innodb_buffer_pool_pages_misc": 4, + "innodb_buffer_pool_pages_total": 8192, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 16723, + "innodb_buffer_pool_reads": 878, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 2377, + "innodb_data_fsyncs": 255, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 14453760, + "innodb_data_reads": 899, + "innodb_data_writes": 561, + "innodb_data_written": 6128128, + "innodb_log_waits": 0, + "innodb_log_write_requests": 1062, + "innodb_log_writes": 116, + "innodb_os_log_fsyncs": 69, + "innodb_os_log_pending_fsyncs": 0, + "innodb_os_log_pending_writes": 0, + "innodb_os_log_written": 147968, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 0, + "innodb_rows_read": 0, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 6698, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 2, + "open_files": 8, + "open_tables": 127, + "opened_files": 8, + "opened_tables": 208, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "queries": 27, + "questions": 15, + "seconds_behind_master_master1": 0, + "seconds_behind_master_master2": 0, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 12, + "slave_io_running_master1": 1, + "slave_io_running_master2": 1, + "slave_sql_running_master1": 1, + "slave_sql_running_master2": 1, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 0, + "table_locks_immediate": 6, + "table_locks_waited": 0, + "table_open_cache": 4000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 800, + "threads_cached": 1, + "threads_connected": 1, + "threads_created": 2, + "threads_running": 2, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + "Percona-Standalone[v8.0.29]: success on all queries": { + { + prepareMock: func(t *testing.T, m sqlmock.Sqlmock) { + mockExpect(t, m, queryShowVersion, dataPerconaVer8029Version) + mockExpect(t, m, queryShowSessionVariables, dataSessionVariables) + mockExpect(t, m, queryDisableSessionQueryLog, nil) + mockExpect(t, m, queryDisableSessionSlowQueryLog, nil) + mockExpect(t, m, queryShowGlobalStatus, dataPerconaVer8029GlobalStatus) + mockExpect(t, m, queryShowGlobalVariables, dataPerconaVer8029GlobalVariables) + mockExpect(t, m, queryShowReplicaStatus, nil) + mockExpect(t, m, queryShowUserStatistics, dataPerconaVer8029UserStatistics) + mockExpect(t, m, queryShowProcessListPS, dataPerconaV8029ProcessList) + }, + check: func(t *testing.T, my *MySQL) { + mx := my.Collect() + + expected := map[string]int64{ + "aborted_connects": 1, + "binlog_cache_disk_use": 0, + "binlog_cache_use": 0, + "binlog_stmt_cache_disk_use": 0, + "binlog_stmt_cache_use": 0, + "bytes_received": 682970, + "bytes_sent": 33668405, + "com_delete": 0, + "com_insert": 0, + "com_replace": 0, + "com_select": 1687, + "com_update": 0, + "connection_errors_accept": 0, + "connection_errors_internal": 0, + "connection_errors_max_connections": 0, + "connection_errors_peer_address": 0, + "connection_errors_select": 0, + "connection_errors_tcpwrap": 0, + "connections": 13, + "created_tmp_disk_tables": 1683, + "created_tmp_files": 5, + "created_tmp_tables": 5054, + "handler_commit": 576, + "handler_delete": 0, + "handler_prepare": 0, + "handler_read_first": 1724, + "handler_read_key": 3439, + "handler_read_next": 4147, + "handler_read_prev": 0, + "handler_read_rnd": 0, + "handler_read_rnd_next": 2983285, + "handler_rollback": 0, + "handler_savepoint": 0, + "handler_savepoint_rollback": 0, + "handler_update": 317, + "handler_write": 906501, + "innodb_buffer_pool_bytes_data": 18399232, + "innodb_buffer_pool_bytes_dirty": 49152, + "innodb_buffer_pool_pages_data": 1123, + "innodb_buffer_pool_pages_dirty": 3, + "innodb_buffer_pool_pages_flushed": 205, + "innodb_buffer_pool_pages_free": 7064, + "innodb_buffer_pool_pages_misc": 5, + "innodb_buffer_pool_pages_total": 8192, + "innodb_buffer_pool_read_ahead": 0, + "innodb_buffer_pool_read_ahead_evicted": 0, + "innodb_buffer_pool_read_ahead_rnd": 0, + "innodb_buffer_pool_read_requests": 109817, + "innodb_buffer_pool_reads": 978, + "innodb_buffer_pool_wait_free": 0, + "innodb_buffer_pool_write_requests": 77412, + "innodb_data_fsyncs": 50, + "innodb_data_pending_fsyncs": 0, + "innodb_data_pending_reads": 0, + "innodb_data_pending_writes": 0, + "innodb_data_read": 16094208, + "innodb_data_reads": 1002, + "innodb_data_writes": 288, + "innodb_data_written": 3420160, + "innodb_log_waits": 0, + "innodb_log_write_requests": 651, + "innodb_log_writes": 47, + "innodb_os_log_fsyncs": 13, + "innodb_os_log_pending_fsyncs": 0, + "innodb_os_log_pending_writes": 0, + "innodb_os_log_written": 45568, + "innodb_row_lock_current_waits": 0, + "innodb_rows_deleted": 0, + "innodb_rows_inserted": 5055, + "innodb_rows_read": 5055, + "innodb_rows_updated": 0, + "key_blocks_not_flushed": 0, + "key_blocks_unused": 6698, + "key_blocks_used": 0, + "key_read_requests": 0, + "key_reads": 0, + "key_write_requests": 0, + "key_writes": 0, + "max_connections": 151, + "max_used_connections": 3, + "open_files": 2, + "open_tables": 77, + "opened_files": 2, + "opened_tables": 158, + "process_list_fetch_query_duration": 0, + "process_list_longest_query_duration": 9, + "process_list_queries_count_system": 0, + "process_list_queries_count_user": 2, + "queries": 6748, + "questions": 6746, + "select_full_join": 0, + "select_full_range_join": 0, + "select_range": 0, + "select_range_check": 0, + "select_scan": 8425, + "slow_queries": 0, + "sort_merge_passes": 0, + "sort_range": 0, + "sort_scan": 1681, + "table_locks_immediate": 3371, + "table_locks_waited": 0, + "table_open_cache": 4000, + "table_open_cache_overflows": 0, + "thread_cache_misses": 2307, + "threads_cached": 1, + "threads_connected": 2, + "threads_created": 3, + "threads_running": 2, + "userstats_netdata_access_denied": 0, + "userstats_netdata_binlog_bytes_written": 0, + "userstats_netdata_commit_transactions": 0, + "userstats_netdata_cpu_time": 0, + "userstats_netdata_denied_connections": 0, + "userstats_netdata_empty_queries": 0, + "userstats_netdata_lost_connections": 0, + "userstats_netdata_other_commands": 1, + "userstats_netdata_rollback_transactions": 0, + "userstats_netdata_rows_fetched": 1, + "userstats_netdata_rows_updated": 0, + "userstats_netdata_select_commands": 1, + "userstats_netdata_total_connections": 1, + "userstats_netdata_update_commands": 0, + "userstats_root_access_denied": 0, + "userstats_root_binlog_bytes_written": 0, + "userstats_root_commit_transactions": 0, + "userstats_root_cpu_time": 151, + "userstats_root_denied_connections": 1, + "userstats_root_empty_queries": 36, + "userstats_root_lost_connections": 0, + "userstats_root_other_commands": 110, + "userstats_root_rollback_transactions": 0, + "userstats_root_rows_fetched": 1, + "userstats_root_rows_updated": 0, + "userstats_root_select_commands": 37, + "userstats_root_total_connections": 2, + "userstats_root_update_commands": 0, + } + + copyProcessListQueryDuration(mx, expected) + require.Equal(t, expected, mx) + ensureCollectedHasAllChartsDimsVarsIDs(t, my, mx) + }, + }, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + db, mock, err := sqlmock.New( + sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual), + ) + require.NoError(t, err) + my := New() + my.db = db + defer func() { _ = db.Close() }() + + require.NoError(t, my.Init()) + + for i, step := range test { + t.Run(fmt.Sprintf("step[%d]", i), func(t *testing.T) { + step.prepareMock(t, mock) + step.check(t, my) + }) + } + assert.NoError(t, mock.ExpectationsWereMet()) + }) + } +} + +func ensureCollectedHasAllChartsDimsVarsIDs(t *testing.T, mySQL *MySQL, collected map[string]int64) { + for _, chart := range *mySQL.Charts() { + if mySQL.isMariaDB { + // https://mariadb.com/kb/en/server-status-variables/#connection_errors_accept + if mySQL.version.LT(semver.Version{Major: 10, Minor: 0, Patch: 4}) && chart.ID == "connection_errors" { + continue + } + } + for _, dim := range chart.Dims { + _, ok := collected[dim.ID] + assert.Truef(t, ok, "collected metrics has no data for dim '%s' chart '%s'", dim.ID, chart.ID) + } + for _, v := range chart.Vars { + _, ok := collected[v.ID] + assert.Truef(t, ok, "collected metrics has no data for var '%s' chart '%s'", v.ID, chart.ID) + } + } +} + +func copyProcessListQueryDuration(dst, src map[string]int64) { + if _, ok := dst["process_list_fetch_query_duration"]; !ok { + return + } + if _, ok := src["process_list_fetch_query_duration"]; !ok { + return + } + dst["process_list_fetch_query_duration"] = src["process_list_fetch_query_duration"] +} + +func mustMockRows(t *testing.T, data []byte) *sqlmock.Rows { + rows, err := prepareMockRows(data) + require.NoError(t, err) + return rows +} + +func mockExpect(t *testing.T, mock sqlmock.Sqlmock, query string, rows []byte) { + mock.ExpectQuery(query).WillReturnRows(mustMockRows(t, rows)).RowsWillBeClosed() +} + +func mockExpectErr(mock sqlmock.Sqlmock, query string) { + mock.ExpectQuery(query).WillReturnError(fmt.Errorf("mock error (%s)", query)) +} + +func prepareMockRows(data []byte) (*sqlmock.Rows, error) { + if len(data) == 0 { + return sqlmock.NewRows(nil), nil + } + + r := bytes.NewReader(data) + sc := bufio.NewScanner(r) + + var numColumns int + var rows *sqlmock.Rows + + for sc.Scan() { + s := strings.TrimSpace(strings.Trim(sc.Text(), "|")) + switch { + case s == "", + strings.HasPrefix(s, "+"), + strings.HasPrefix(s, "ft_boolean_syntax"): + continue + } + + parts := strings.Split(s, "|") + for i, v := range parts { + parts[i] = strings.TrimSpace(v) + } + + if rows == nil { + numColumns = len(parts) + rows = sqlmock.NewRows(parts) + continue + } + + if len(parts) != numColumns { + return nil, fmt.Errorf("prepareMockRows(): columns != values (%d/%d)", numColumns, len(parts)) + } + + values := make([]driver.Value, len(parts)) + for i, v := range parts { + values[i] = v + } + rows.AddRow(values...) + } + + if rows == nil { + return nil, errors.New("prepareMockRows(): nil rows result") + } + + return rows, sc.Err() +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/config.json b/src/go/collectors/go.d.plugin/modules/mysql/testdata/config.json new file mode 100644 index 000000000..92a65cb5c --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/config.json @@ -0,0 +1,6 @@ +{ + "update_every": 123, + "dsn": "ok", + "my.cnf": "ok", + "timeout": 123.123 +} diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/config.yaml b/src/go/collectors/go.d.plugin/modules/mysql/testdata/config.yaml new file mode 100644 index 000000000..9bb474b94 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/config.yaml @@ -0,0 +1,4 @@ +update_every: 123 +dsn: "ok" +my.cnf: "ok" +timeout: 123.123 diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/global_status.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/global_status.txt new file mode 100644 index 000000000..8a6b691cd --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/global_status.txt @@ -0,0 +1,621 @@ ++--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+ +| Variable_name | Value | ++--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+ +| Aborted_clients | 0 | +| Aborted_connects | 0 | +| Aborted_connects_preauth | 0 | +| Access_denied_errors | 0 | +| Acl_column_grants | 0 | +| Acl_database_grants | 3 | +| Acl_function_grants | 0 | +| Acl_procedure_grants | 0 | +| Acl_package_spec_grants | 0 | +| Acl_package_body_grants | 0 | +| Acl_proxy_users | 1 | +| Acl_role_grants | 0 | +| Acl_roles | 0 | +| Acl_table_grants | 1 | +| Acl_users | 6 | +| Aria_pagecache_blocks_not_flushed | 0 | +| Aria_pagecache_blocks_unused | 15647 | +| Aria_pagecache_blocks_used | 13 | +| Aria_pagecache_read_requests | 306 | +| Aria_pagecache_reads | 17 | +| Aria_pagecache_write_requests | 8 | +| Aria_pagecache_writes | 8 | +| Aria_transaction_log_syncs | 0 | +| Binlog_commits | 0 | +| Binlog_group_commits | 0 | +| Binlog_group_commit_trigger_count | 0 | +| Binlog_group_commit_trigger_lock_wait | 0 | +| Binlog_group_commit_trigger_timeout | 0 | +| Binlog_snapshot_file | mysql-bin.000005 | +| Binlog_snapshot_position | 385 | +| Binlog_bytes_written | 183 | +| Binlog_cache_disk_use | 0 | +| Binlog_cache_use | 0 | +| Binlog_stmt_cache_disk_use | 0 | +| Binlog_stmt_cache_use | 0 | +| Busy_time | 0.000000 | +| Bytes_received | 3009 | +| Bytes_sent | 228856 | +| Column_compressions | 0 | +| Column_decompressions | 0 | +| Com_admin_commands | 0 | +| Com_alter_db | 0 | +| Com_alter_db_upgrade | 0 | +| Com_alter_event | 0 | +| Com_alter_function | 0 | +| Com_alter_procedure | 0 | +| Com_alter_server | 0 | +| Com_alter_sequence | 0 | +| Com_alter_table | 3 | +| Com_alter_user | 0 | +| Com_analyze | 0 | +| Com_assign_to_keycache | 0 | +| Com_backup | 6 | +| Com_backup_lock | 0 | +| Com_begin | 0 | +| Com_binlog | 0 | +| Com_call_procedure | 0 | +| Com_change_db | 0 | +| Com_change_master | 0 | +| Com_check | 0 | +| Com_checksum | 0 | +| Com_commit | 0 | +| Com_compound_sql | 0 | +| Com_create_db | 1 | +| Com_create_event | 0 | +| Com_create_function | 0 | +| Com_create_index | 0 | +| Com_create_package | 0 | +| Com_create_package_body | 0 | +| Com_create_procedure | 0 | +| Com_create_role | 0 | +| Com_create_sequence | 0 | +| Com_create_server | 0 | +| Com_create_table | 3 | +| Com_create_temporary_table | 0 | +| Com_create_trigger | 0 | +| Com_create_udf | 0 | +| Com_create_user | 0 | +| Com_create_view | 0 | +| Com_dealloc_sql | 0 | +| Com_delete | 6 | +| Com_delete_multi | 0 | +| Com_do | 0 | +| Com_drop_db | 0 | +| Com_drop_event | 0 | +| Com_drop_function | 0 | +| Com_drop_index | 0 | +| Com_drop_procedure | 0 | +| Com_drop_package | 0 | +| Com_drop_package_body | 0 | +| Com_drop_role | 0 | +| Com_drop_server | 0 | +| Com_drop_sequence | 0 | +| Com_drop_table | 0 | +| Com_drop_temporary_table | 0 | +| Com_drop_trigger | 0 | +| Com_drop_user | 0 | +| Com_drop_view | 0 | +| Com_empty_query | 0 | +| Com_execute_immediate | 0 | +| Com_execute_sql | 0 | +| Com_flush | 4 | +| Com_get_diagnostics | 0 | +| Com_grant | 0 | +| Com_grant_role | 0 | +| Com_ha_close | 0 | +| Com_ha_open | 0 | +| Com_ha_read | 0 | +| Com_help | 0 | +| Com_insert | 0 | +| Com_insert_select | 0 | +| Com_install_plugin | 0 | +| Com_kill | 0 | +| Com_load | 0 | +| Com_lock_tables | 0 | +| Com_optimize | 0 | +| Com_preload_keys | 0 | +| Com_prepare_sql | 0 | +| Com_purge | 0 | +| Com_purge_before_date | 0 | +| Com_release_savepoint | 0 | +| Com_rename_table | 0 | +| Com_rename_user | 0 | +| Com_repair | 0 | +| Com_replace | 0 | +| Com_replace_select | 0 | +| Com_reset | 0 | +| Com_resignal | 0 | +| Com_revoke | 0 | +| Com_revoke_all | 0 | +| Com_revoke_role | 0 | +| Com_rollback | 0 | +| Com_rollback_to_savepoint | 0 | +| Com_savepoint | 0 | +| Com_select | 12 | +| Com_set_option | 6 | +| Com_show_authors | 0 | +| Com_show_binlog_events | 0 | +| Com_show_binlogs | 0 | +| Com_show_charsets | 0 | +| Com_show_collations | 0 | +| Com_show_contributors | 0 | +| Com_show_create_db | 0 | +| Com_show_create_event | 0 | +| Com_show_create_func | 0 | +| Com_show_create_package | 0 | +| Com_show_create_package_body | 0 | +| Com_show_create_proc | 0 | +| Com_show_create_table | 0 | +| Com_show_create_trigger | 0 | +| Com_show_create_user | 0 | +| Com_show_databases | 1 | +| Com_show_engine_logs | 0 | +| Com_show_engine_mutex | 0 | +| Com_show_engine_status | 2 | +| Com_show_errors | 0 | +| Com_show_events | 0 | +| Com_show_explain | 0 | +| Com_show_fields | 0 | +| Com_show_function_status | 0 | +| Com_show_generic | 0 | +| Com_show_grants | 2 | +| Com_show_keys | 0 | +| Com_show_binlog_status | 6 | +| Com_show_open_tables | 0 | +| Com_show_package_status | 0 | +| Com_show_package_body_status | 0 | +| Com_show_plugins | 0 | +| Com_show_privileges | 0 | +| Com_show_procedure_status | 0 | +| Com_show_processlist | 0 | +| Com_show_profile | 0 | +| Com_show_profiles | 0 | +| Com_show_relaylog_events | 0 | +| Com_show_slave_hosts | 0 | +| Com_show_slave_status | 6 | +| Com_show_status | 6 | +| Com_show_storage_engines | 0 | +| Com_show_table_status | 0 | +| Com_show_tables | 0 | +| Com_show_triggers | 0 | +| Com_show_variables | 6 | +| Com_show_warnings | 0 | +| Com_shutdown | 0 | +| Com_signal | 0 | +| Com_start_all_slaves | 0 | +| Com_start_slave | 0 | +| Com_stmt_close | 0 | +| Com_stmt_execute | 0 | +| Com_stmt_fetch | 0 | +| Com_stmt_prepare | 0 | +| Com_stmt_reprepare | 0 | +| Com_stmt_reset | 0 | +| Com_stmt_send_long_data | 0 | +| Com_stop_all_slaves | 0 | +| Com_stop_slave | 0 | +| Com_truncate | 0 | +| Com_uninstall_plugin | 0 | +| Com_unlock_tables | 0 | +| Com_update | 0 | +| Com_update_multi | 0 | +| Com_xa_commit | 0 | +| Com_xa_end | 0 | +| Com_xa_prepare | 0 | +| Com_xa_recover | 0 | +| Com_xa_rollback | 0 | +| Com_xa_start | 0 | +| Compression | OFF | +| Connection_errors_accept | 0 | +| Connection_errors_internal | 0 | +| Connection_errors_max_connections | 0 | +| Connection_errors_peer_address | 0 | +| Connection_errors_select | 0 | +| Connection_errors_tcpwrap | 0 | +| Connections | 15 | +| Cpu_time | 0.000000 | +| Created_tmp_disk_tables | 4 | +| Created_tmp_files | 5 | +| Created_tmp_tables | 17 | +| Delayed_errors | 0 | +| Delayed_insert_threads | 0 | +| Delayed_writes | 0 | +| Delete_scan | 6 | +| Empty_queries | 2 | +| Executed_events | 0 | +| Executed_triggers | 0 | +| Feature_application_time_periods | 0 | +| Feature_check_constraint | 1 | +| Feature_custom_aggregate_functions | 0 | +| Feature_delay_key_write | 0 | +| Feature_dynamic_columns | 0 | +| Feature_fulltext | 0 | +| Feature_gis | 0 | +| Feature_insert_returning | 0 | +| Feature_invisible_columns | 0 | +| Feature_json | 1 | +| Feature_locale | 0 | +| Feature_subquery | 0 | +| Feature_system_versioning | 0 | +| Feature_timezone | 0 | +| Feature_trigger | 0 | +| Feature_window_functions | 0 | +| Feature_xml | 0 | +| Handler_commit | 37 | +| Handler_delete | 7 | +| Handler_discover | 0 | +| Handler_external_lock | 0 | +| Handler_icp_attempts | 0 | +| Handler_icp_match | 0 | +| Handler_mrr_init | 0 | +| Handler_mrr_key_refills | 0 | +| Handler_mrr_rowid_refills | 0 | +| Handler_prepare | 0 | +| Handler_read_first | 3 | +| Handler_read_key | 9 | +| Handler_read_last | 0 | +| Handler_read_next | 1 | +| Handler_read_prev | 0 | +| Handler_read_retry | 0 | +| Handler_read_rnd | 0 | +| Handler_read_rnd_deleted | 0 | +| Handler_read_rnd_next | 6222 | +| Handler_rollback | 0 | +| Handler_savepoint | 0 | +| Handler_savepoint_rollback | 0 | +| Handler_tmp_delete | 0 | +| Handler_tmp_update | 0 | +| Handler_tmp_write | 6165 | +| Handler_update | 0 | +| Handler_write | 9 | +| Innodb_adaptive_hash_hash_searches | 0 | +| Innodb_adaptive_hash_non_hash_searches | 0 | +| Innodb_background_log_sync | 896 | +| Innodb_buffer_pool_dump_status | | +| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 220817 19:46:29 | +| Innodb_buffer_pool_resize_status | | +| Innodb_buffer_pool_load_incomplete | OFF | +| Innodb_buffer_pool_pages_data | 317 | +| Innodb_buffer_pool_bytes_data | 5193728 | +| Innodb_buffer_pool_pages_dirty | 138 | +| Innodb_buffer_pool_bytes_dirty | 2260992 | +| Innodb_buffer_pool_pages_flushed | 0 | +| Innodb_buffer_pool_pages_free | 7747 | +| Innodb_buffer_pool_pages_made_not_young | 0 | +| Innodb_buffer_pool_pages_made_young | 0 | +| Innodb_buffer_pool_pages_misc | 0 | +| Innodb_buffer_pool_pages_old | 0 | +| Innodb_buffer_pool_pages_total | 8064 | +| Innodb_buffer_pool_pages_lru_flushed | 0 | +| Innodb_buffer_pool_pages_lru_freed | 0 | +| Innodb_buffer_pool_read_ahead_rnd | 0 | +| Innodb_buffer_pool_read_ahead | 0 | +| Innodb_buffer_pool_read_ahead_evicted | 0 | +| Innodb_buffer_pool_read_requests | 2298 | +| Innodb_buffer_pool_reads | 184 | +| Innodb_buffer_pool_wait_free | 0 | +| Innodb_buffer_pool_write_requests | 203 | +| Innodb_checkpoint_age | 4785 | +| Innodb_checkpoint_max_age | 80819529 | +| Innodb_data_fsyncs | 15 | +| Innodb_data_pending_fsyncs | 0 | +| Innodb_data_pending_reads | 0 | +| Innodb_data_pending_writes | 0 | +| Innodb_data_read | 3014656 | +| Innodb_data_reads | 201 | +| Innodb_data_writes | 14 | +| Innodb_data_written | 0 | +| Innodb_dblwr_pages_written | 0 | +| Innodb_dblwr_writes | 0 | +| Innodb_deadlocks | 0 | +| Innodb_history_list_length | 1 | +| Innodb_ibuf_discarded_delete_marks | 0 | +| Innodb_ibuf_discarded_deletes | 0 | +| Innodb_ibuf_discarded_inserts | 0 | +| Innodb_ibuf_free_list | 0 | +| Innodb_ibuf_merged_delete_marks | 0 | +| Innodb_ibuf_merged_deletes | 0 | +| Innodb_ibuf_merged_inserts | 0 | +| Innodb_ibuf_merges | 0 | +| Innodb_ibuf_segment_size | 2 | +| Innodb_ibuf_size | 1 | +| Innodb_log_waits | 0 | +| Innodb_log_write_requests | 65 | +| Innodb_log_writes | 13 | +| Innodb_lsn_current | 73172 | +| Innodb_lsn_flushed | 73172 | +| Innodb_lsn_last_checkpoint | 68387 | +| Innodb_master_thread_active_loops | 0 | +| Innodb_master_thread_idle_loops | 896 | +| Innodb_max_trx_id | 38 | +| Innodb_mem_adaptive_hash | 0 | +| Innodb_mem_dictionary | 862248 | +| Innodb_os_log_written | 4785 | +| Innodb_page_size | 16384 | +| Innodb_pages_created | 133 | +| Innodb_pages_read | 184 | +| Innodb_pages_written | 0 | +| Innodb_row_lock_current_waits | 0 | +| Innodb_row_lock_time | 0 | +| Innodb_row_lock_time_avg | 0 | +| Innodb_row_lock_time_max | 0 | +| Innodb_row_lock_waits | 0 | +| Innodb_rows_deleted | 0 | +| Innodb_rows_inserted | 0 | +| Innodb_rows_read | 0 | +| Innodb_rows_updated | 0 | +| Innodb_system_rows_deleted | 7 | +| Innodb_system_rows_inserted | 9 | +| Innodb_system_rows_read | 15 | +| Innodb_system_rows_updated | 0 | +| Innodb_num_open_files | 9 | +| Innodb_truncated_status_writes | 0 | +| Innodb_available_undo_logs | 128 | +| Innodb_undo_truncations | 0 | +| Innodb_page_compression_saved | 0 | +| Innodb_num_pages_page_compressed | 0 | +| Innodb_num_page_compressed_trim_op | 0 | +| Innodb_num_pages_page_decompressed | 0 | +| Innodb_num_pages_page_compression_error | 0 | +| Innodb_num_pages_encrypted | 0 | +| Innodb_num_pages_decrypted | 0 | +| Innodb_have_lz4 | OFF | +| Innodb_have_lzo | OFF | +| Innodb_have_lzma | OFF | +| Innodb_have_bzip2 | OFF | +| Innodb_have_snappy | OFF | +| Innodb_have_punch_hole | ON | +| Innodb_defragment_compression_failures | 0 | +| Innodb_defragment_failures | 0 | +| Innodb_defragment_count | 0 | +| Innodb_instant_alter_column | 0 | +| Innodb_onlineddl_rowlog_rows | 0 | +| Innodb_onlineddl_rowlog_pct_used | 0 | +| Innodb_onlineddl_pct_progress | 0 | +| Innodb_secondary_index_triggered_cluster_reads | 0 | +| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 | +| Innodb_encryption_rotation_pages_read_from_cache | 0 | +| Innodb_encryption_rotation_pages_read_from_disk | 0 | +| Innodb_encryption_rotation_pages_modified | 0 | +| Innodb_encryption_rotation_pages_flushed | 0 | +| Innodb_encryption_rotation_estimated_iops | 0 | +| Innodb_encryption_n_merge_blocks_encrypted | 0 | +| Innodb_encryption_n_merge_blocks_decrypted | 0 | +| Innodb_encryption_n_rowlog_blocks_encrypted | 0 | +| Innodb_encryption_n_rowlog_blocks_decrypted | 0 | +| Innodb_encryption_n_temp_blocks_encrypted | 0 | +| Innodb_encryption_n_temp_blocks_decrypted | 0 | +| Innodb_encryption_num_key_requests | 0 | +| Key_blocks_not_flushed | 0 | +| Key_blocks_unused | 107163 | +| Key_blocks_used | 0 | +| Key_blocks_warm | 0 | +| Key_read_requests | 0 | +| Key_reads | 0 | +| Key_write_requests | 0 | +| Key_writes | 0 | +| Last_query_cost | 0.000000 | +| Master_gtid_wait_count | 0 | +| Master_gtid_wait_time | 0 | +| Master_gtid_wait_timeouts | 0 | +| Max_statement_time_exceeded | 0 | +| Max_used_connections | 1 | +| Memory_used | 35590104 | +| Memory_used_initial | 35583712 | +| Not_flushed_delayed_rows | 0 | +| Open_files | 7 | +| Open_streams | 4 | +| Open_table_definitions | 0 | +| Open_tables | 0 | +| Opened_files | 125 | +| Opened_plugin_libraries | 1 | +| Opened_table_definitions | 27 | +| Opened_tables | 24 | +| Opened_views | 0 | +| Performance_schema_accounts_lost | 0 | +| Performance_schema_cond_classes_lost | 0 | +| Performance_schema_cond_instances_lost | 0 | +| Performance_schema_digest_lost | 0 | +| Performance_schema_file_classes_lost | 0 | +| Performance_schema_file_handles_lost | 0 | +| Performance_schema_file_instances_lost | 0 | +| Performance_schema_hosts_lost | 0 | +| Performance_schema_index_stat_lost | 0 | +| Performance_schema_locker_lost | 0 | +| Performance_schema_memory_classes_lost | 0 | +| Performance_schema_metadata_lock_lost | 0 | +| Performance_schema_mutex_classes_lost | 0 | +| Performance_schema_mutex_instances_lost | 0 | +| Performance_schema_nested_statement_lost | 0 | +| Performance_schema_prepared_statements_lost | 0 | +| Performance_schema_program_lost | 0 | +| Performance_schema_rwlock_classes_lost | 0 | +| Performance_schema_rwlock_instances_lost | 0 | +| Performance_schema_session_connect_attrs_lost | 0 | +| Performance_schema_socket_classes_lost | 0 | +| Performance_schema_socket_instances_lost | 0 | +| Performance_schema_stage_classes_lost | 0 | +| Performance_schema_statement_classes_lost | 0 | +| Performance_schema_table_handles_lost | 0 | +| Performance_schema_table_instances_lost | 0 | +| Performance_schema_table_lock_stat_lost | 0 | +| Performance_schema_thread_classes_lost | 0 | +| Performance_schema_thread_instances_lost | 0 | +| Performance_schema_users_lost | 0 | +| Prepared_stmt_count | 0 | +| Qcache_free_blocks | 1 | +| Qcache_free_memory | 1031272 | +| Qcache_hits | 0 | +| Qcache_inserts | 0 | +| Qcache_lowmem_prunes | 0 | +| Qcache_not_cached | 0 | +| Qcache_queries_in_cache | 0 | +| Qcache_total_blocks | 1 | +| Queries | 75 | +| Questions | 62 | +| Resultset_metadata_skipped | 0 | +| Rows_read | 27 | +| Rows_sent | 5888 | +| Rows_tmp_read | 6162 | +| Rpl_semi_sync_master_clients | 0 | +| Rpl_semi_sync_master_get_ack | 0 | +| Rpl_semi_sync_master_net_avg_wait_time | 0 | +| Rpl_semi_sync_master_net_wait_time | 0 | +| Rpl_semi_sync_master_net_waits | 0 | +| Rpl_semi_sync_master_no_times | 0 | +| Rpl_semi_sync_master_no_tx | 0 | +| Rpl_semi_sync_master_request_ack | 0 | +| Rpl_semi_sync_master_status | OFF | +| Rpl_semi_sync_master_timefunc_failures | 0 | +| Rpl_semi_sync_master_tx_avg_wait_time | 0 | +| Rpl_semi_sync_master_tx_wait_time | 0 | +| Rpl_semi_sync_master_tx_waits | 0 | +| Rpl_semi_sync_master_wait_pos_backtraverse | 0 | +| Rpl_semi_sync_master_wait_sessions | 0 | +| Rpl_semi_sync_master_yes_tx | 0 | +| Rpl_semi_sync_slave_send_ack | 0 | +| Rpl_semi_sync_slave_status | OFF | +| Rpl_status | AUTH_MASTER | +| Rpl_transactions_multi_engine | 0 | +| Select_full_join | 0 | +| Select_full_range_join | 0 | +| Select_range | 0 | +| Select_range_check | 0 | +| Select_scan | 17 | +| Slave_connections | 0 | +| Slave_heartbeat_period | 0.000 | +| Slave_open_temp_tables | 0 | +| Slave_received_heartbeats | 0 | +| Slave_retried_transactions | 0 | +| Slave_running | OFF | +| Slave_skipped_errors | 0 | +| Slaves_connected | 0 | +| Slaves_running | 0 | +| Slow_launch_threads | 0 | +| Slow_queries | 0 | +| Sort_merge_passes | 0 | +| Sort_priority_queue_sorts | 0 | +| Sort_range | 0 | +| Sort_rows | 0 | +| Sort_scan | 0 | +| Ssl_accept_renegotiates | 0 | +| Ssl_accepts | 0 | +| Ssl_callback_cache_hits | 0 | +| Ssl_cipher | | +| Ssl_cipher_list | | +| Ssl_client_connects | 0 | +| Ssl_connect_renegotiates | 0 | +| Ssl_ctx_verify_depth | 0 | +| Ssl_ctx_verify_mode | 0 | +| Ssl_default_timeout | 0 | +| Ssl_finished_accepts | 0 | +| Ssl_finished_connects | 0 | +| Ssl_server_not_after | | +| Ssl_server_not_before | | +| Ssl_session_cache_hits | 0 | +| Ssl_session_cache_misses | 0 | +| Ssl_session_cache_mode | NONE | +| Ssl_session_cache_overflows | 0 | +| Ssl_session_cache_size | 0 | +| Ssl_session_cache_timeouts | 0 | +| Ssl_sessions_reused | 0 | +| Ssl_used_session_cache_entries | 0 | +| Ssl_verify_depth | 0 | +| Ssl_verify_mode | 0 | +| Ssl_version | | +| Subquery_cache_hit | 0 | +| Subquery_cache_miss | 0 | +| Syncs | 87 | +| Table_locks_immediate | 17 | +| Table_locks_waited | 0 | +| Table_open_cache_active_instances | 1 | +| Table_open_cache_hits | 16 | +| Table_open_cache_misses | 24 | +| Table_open_cache_overflows | 0 | +| Tc_log_max_pages_used | 0 | +| Tc_log_page_size | 0 | +| Tc_log_page_waits | 0 | +| Threadpool_idle_threads | 0 | +| Threadpool_threads | 0 | +| Threads_cached | 0 | +| Threads_connected | 1 | +| Threads_created | 6 | +| Threads_running | 1 | +| Transactions_gtid_foreign_engine | 0 | +| Transactions_multi_engine | 0 | +| Update_scan | 0 | +| Uptime | 895 | +| Uptime_since_flush_status | 895 | +| wsrep_local_state_uuid | 479ce105-1e65-11ed-b2c3-8ac44f1dd1c9 | +| wsrep_protocol_version | 10 | +| wsrep_last_committed | 18 | +| wsrep_replicated | 0 | +| wsrep_replicated_bytes | 0 | +| wsrep_repl_keys | 0 | +| wsrep_repl_keys_bytes | 0 | +| wsrep_repl_data_bytes | 0 | +| wsrep_repl_other_bytes | 0 | +| wsrep_received | 11 | +| wsrep_received_bytes | 1410 | +| wsrep_local_commits | 0 | +| wsrep_local_cert_failures | 0 | +| wsrep_local_replays | 0 | +| wsrep_local_send_queue | 0 | +| wsrep_local_send_queue_max | 2 | +| wsrep_local_send_queue_min | 0 | +| wsrep_local_send_queue_avg | 0.25 | +| wsrep_local_recv_queue | 0 | +| wsrep_local_recv_queue_max | 1 | +| wsrep_local_recv_queue_min | 0 | +| wsrep_local_recv_queue_avg | 0 | +| wsrep_local_cached_downto | 1 | +| wsrep_flow_control_paused_ns | 0 | +| wsrep_flow_control_paused | 0 | +| wsrep_flow_control_sent | 0 | +| wsrep_flow_control_recv | 0 | +| wsrep_flow_control_active | false | +| wsrep_flow_control_requested | false | +| wsrep_cert_deps_distance | 1 | +| wsrep_apply_oooe | 0 | +| wsrep_apply_oool | 0 | +| wsrep_apply_window | 1 | +| wsrep_apply_waits | 0 | +| wsrep_commit_oooe | 0 | +| wsrep_commit_oool | 0 | +| wsrep_commit_window | 1 | +| wsrep_local_state | 4 | +| wsrep_local_state_comment | Synced | +| wsrep_cert_index_size | 1 | +| wsrep_causal_reads | 0 | +| wsrep_cert_interval | 0 | +| wsrep_open_transactions | 0 | +| wsrep_open_connections | 0 | +| wsrep_incoming_addresses | 172.17.0.2:3306,172.17.0.4:3306,172.17.0.3:3306 | +| wsrep_cluster_weight | 3 | +| wsrep_desync_count | 0 | +| wsrep_evs_delayed | | +| wsrep_evs_evict_list | | +| wsrep_evs_repl_latency | 0.000200973/0.125339/1.00029/0.330702/8 | +| wsrep_evs_state | OPERATIONAL | +| wsrep_gcomm_uuid | 49826f19-1e65-11ed-8435-a308cd7c3ccc | +| wsrep_gmcast_segment | 0 | +| wsrep_applier_thread_count | 4 | +| wsrep_cluster_capabilities | | +| wsrep_cluster_conf_id | 3 | +| wsrep_cluster_size | 3 | +| wsrep_cluster_state_uuid | 479ce105-1e65-11ed-b2c3-8ac44f1dd1c9 | +| wsrep_cluster_status | Primary | +| wsrep_connected | ON | +| wsrep_local_bf_aborts | 0 | +| wsrep_local_index | 0 | +| wsrep_provider_capabilities | :MULTI_MASTER:CERTIFICATION:PARALLEL_APPLYING:TRX_REPLAY:ISOLATION:PAUSE:CAUSAL_READS:INCREMENTAL_WRITESET:UNORDERED:PREORDERED:STREAMING:NBO: | +| wsrep_provider_name | Galera | +| wsrep_provider_vendor | Codership Oy <info@codership.com> | +| wsrep_provider_version | 4.12(r6311685) | +| wsrep_ready | ON | +| wsrep_rollbacker_thread_count | 1 | +| wsrep_thread_count | 5 | ++--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/global_variables.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/global_variables.txt new file mode 100644 index 000000000..96591afdf --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/global_variables.txt @@ -0,0 +1,8 @@ ++--------------------+-------+ +| Variable_name | Value | ++--------------------+-------+ +| log_bin | ON | +| max_connections | 151 | +| performance_schema | ON | +| table_open_cache | 2000 | ++--------------------+-------+ diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/process_list.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/process_list.txt new file mode 100644 index 000000000..a44ce5e70 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/process_list.txt @@ -0,0 +1,6 @@ ++------+---------+ +| time | user | ++------+---------+ +| 1 | netdata | +| 9 | root | ++------+---------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/user_statistics.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/user_statistics.txt new file mode 100644 index 000000000..7a44b8b5a --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/user_statistics.txt @@ -0,0 +1,6 @@ ++---------+-------------------+------------------------+----------------+---------------------+---------------------+----------------+------------+----------------------+-----------+-----------+--------------+---------------+--------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+-----------------------------+ +| User | Total_connections | Concurrent_connections | Connected_time | Busy_time | Cpu_time | Bytes_received | Bytes_sent | Binlog_bytes_written | Rows_read | Rows_sent | Rows_deleted | Rows_inserted | Rows_updated | Select_commands | Update_commands | Other_commands | Commit_transactions | Rollback_transactions | Denied_connections | Lost_connections | Access_denied | Empty_queries | Total_ssl_connections | Max_statement_time_exceeded | ++---------+-------------------+------------------------+----------------+---------------------+---------------------+----------------+------------+----------------------+-----------+-----------+--------------+---------------+--------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+-----------------------------+ +| root | 1 | 0 | 9 | 0.000156 | 0.0001541 | 25 | 2799 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| netdata | 1 | 0 | 32 | 0.09262200000000004 | 0.07723410000000001 | 13440 | 105432 | 0 | 0 | 99 | 0 | 0 | 0 | 33 | 0 | 0 | 0 | 0 | 49698 | 0 | 33 | 66 | 0 | 0 | ++---------+-------------------+------------------------+----------------+---------------------+---------------------+----------------+------------+----------------------+-----------+-----------+--------------+---------------+--------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+-----------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/version.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/version.txt new file mode 100644 index 000000000..ee5e77d9a --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4-galera-cluster/version.txt @@ -0,0 +1,6 @@ ++-----------------+---------------------+ +| Variable_name | Value | ++-----------------+---------------------+ +| version | 10.8.4-MariaDB-log | +| version_comment | Source distribution | ++-----------------+---------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/all_slaves_status_multi_source.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/all_slaves_status_multi_source.txt new file mode 100644 index 000000000..b117cb6c7 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/all_slaves_status_multi_source.txt @@ -0,0 +1,6 @@ ++-----------------+--------------------------------------------------------+----------------------------------+-------------+--------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+----------------+--------------------+------------+-------------+-------------------------+-----------------------------+---------------+-----------+---------------------+--------------------------------------------------------+------------------+--------------------------------+----------------------------+----------------------+--------------------+----------------------+---------------------------+------------------------+----------------+ +| Connection_name | Slave_SQL_State | Slave_IO_State | Master_Host | Master_User | Master_Port | Connect_Retry | Master_Log_File | Read_Master_Log_Pos | Relay_Log_File | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File | Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seconds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Error | Last_SQL_Errno | Last_SQL_Error | Replicate_Ignore_Server_Ids | Master_Server_Id | Master_SSL_Crl | Master_SSL_Crlpath | Using_Gtid | Gtid_IO_Pos | Replicate_Do_Domain_Ids | Replicate_Ignore_Domain_Ids | Parallel_Mode | SQL_Delay | SQL_Remaining_Delay | Slave_SQL_Running_State | Slave_DDL_Groups | Slave_Non_Transactional_Groups | Slave_Transactional_Groups | Retried_transactions | Max_relay_log_size | Executed_log_entries | Slave_received_heartbeats | Slave_heartbeat_period | Gtid_Slave_Pos | ++-----------------+--------------------------------------------------------+----------------------------------+-------------+--------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+----------------+--------------------+------------+-------------+-------------------------+-----------------------------+---------------+-----------+---------------------+--------------------------------------------------------+------------------+--------------------------------+----------------------------+----------------------+--------------------+----------------------+---------------------------+------------------------+----------------+ +| Master1 | Slave has read all relay log; waiting for more updates | Waiting for master to send event | master | my_repl_user | 3306 | 10 | mysql-bin.000002 | 342 | mysql-relay-bin.000004 | 641 | mysql-bin.000002 | Yes | Yes | | | | | | | 0 | | 0 | 342 | 2785 | None | | 0 | No | | | | | | 0 | No | 0 | | 0 | | | 765 | | | No | | | | optimistic | 0 | NULL | Slave has read all relay log; waiting for more updates | 7 | 2 | 0 | 0 | 1073741824 | 34 | 1767 | 30.000 | 0-308-9 | +| Master2 | Slave has read all relay log; waiting for more updates | Waiting for master to send event | master | my_repl_user | 3306 | 10 | mysql-bin.000002 | 342 | mysql-relay-bin.000004 | 641 | mysql-bin.000002 | Yes | Yes | | | | | | | 0 | | 0 | 342 | 2785 | None | | 0 | No | | | | | | 0 | No | 0 | | 0 | | | 765 | | | No | | | | optimistic | 0 | NULL | Slave has read all relay log; waiting for more updates | 7 | 2 | 0 | 0 | 1073741824 | 34 | 1767 | 30.000 | 0-308-9 | ++-----------------+--------------------------------------------------------+----------------------------------+-------------+--------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+----------------+--------------------+------------+-------------+-------------------------+-----------------------------+---------------+-----------+---------------------+--------------------------------------------------------+------------------+--------------------------------+----------------------------+----------------------+--------------------+----------------------+---------------------------+------------------------+----------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/all_slaves_status_single_source.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/all_slaves_status_single_source.txt new file mode 100644 index 000000000..61428f084 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/all_slaves_status_single_source.txt @@ -0,0 +1,5 @@ ++-----------------+--------------------------------------------------------+----------------------------------+-------------+--------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+----------------+--------------------+------------+-------------+-------------------------+-----------------------------+---------------+-----------+---------------------+--------------------------------------------------------+------------------+--------------------------------+----------------------------+----------------------+--------------------+----------------------+---------------------------+------------------------+----------------+ +| Connection_name | Slave_SQL_State | Slave_IO_State | Master_Host | Master_User | Master_Port | Connect_Retry | Master_Log_File | Read_Master_Log_Pos | Relay_Log_File | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File | Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seconds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Error | Last_SQL_Errno | Last_SQL_Error | Replicate_Ignore_Server_Ids | Master_Server_Id | Master_SSL_Crl | Master_SSL_Crlpath | Using_Gtid | Gtid_IO_Pos | Replicate_Do_Domain_Ids | Replicate_Ignore_Domain_Ids | Parallel_Mode | SQL_Delay | SQL_Remaining_Delay | Slave_SQL_Running_State | Slave_DDL_Groups | Slave_Non_Transactional_Groups | Slave_Transactional_Groups | Retried_transactions | Max_relay_log_size | Executed_log_entries | Slave_received_heartbeats | Slave_heartbeat_period | Gtid_Slave_Pos | ++-----------------+--------------------------------------------------------+----------------------------------+-------------+--------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+----------------+--------------------+------------+-------------+-------------------------+-----------------------------+---------------+-----------+---------------------+--------------------------------------------------------+------------------+--------------------------------+----------------------------+----------------------+--------------------+----------------------+---------------------------+------------------------+----------------+ +| | Slave has read all relay log; waiting for more updates | Waiting for master to send event | master | my_repl_user | 3306 | 10 | mysql-bin.000002 | 342 | mysql-relay-bin.000004 | 641 | mysql-bin.000002 | Yes | Yes | | | | | | | 0 | | 0 | 342 | 2785 | None | | 0 | No | | | | | | 0 | No | 0 | | 0 | | | 765 | | | No | | | | optimistic | 0 | NULL | Slave has read all relay log; waiting for more updates | 7 | 2 | 0 | 0 | 1073741824 | 34 | 1767 | 30.000 | 0-308-9 | ++-----------------+--------------------------------------------------------+----------------------------------+-------------+--------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+----------------+--------------------+------------+-------------+-------------------------+-----------------------------+---------------+-----------+---------------------+--------------------------------------------------------+------------------+--------------------------------+----------------------------+----------------------+--------------------+----------------------+---------------------------+------------------------+----------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/global_status.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/global_status.txt new file mode 100644 index 000000000..c82531c74 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/global_status.txt @@ -0,0 +1,569 @@ ++--------------------------------------------------------+--------------------------------------------------+ +| Variable_name | Value | ++--------------------------------------------------------+--------------------------------------------------+ +| Aborted_clients | 1 | +| Aborted_connects | 2 | +| Aborted_connects_preauth | 0 | +| Access_denied_errors | 2 | +| Acl_column_grants | 0 | +| Acl_database_grants | 3 | +| Acl_function_grants | 0 | +| Acl_procedure_grants | 0 | +| Acl_package_spec_grants | 0 | +| Acl_package_body_grants | 0 | +| Acl_proxy_users | 1 | +| Acl_role_grants | 0 | +| Acl_roles | 0 | +| Acl_table_grants | 1 | +| Acl_users | 4 | +| Aria_pagecache_blocks_not_flushed | 7 | +| Aria_pagecache_blocks_unused | 15630 | +| Aria_pagecache_blocks_used | 17 | +| Aria_pagecache_read_requests | 78 | +| Aria_pagecache_reads | 19 | +| Aria_pagecache_write_requests | 8 | +| Aria_pagecache_writes | 0 | +| Aria_transaction_log_syncs | 6 | +| Binlog_commits | 0 | +| Binlog_group_commits | 0 | +| Binlog_group_commit_trigger_count | 0 | +| Binlog_group_commit_trigger_lock_wait | 0 | +| Binlog_group_commit_trigger_timeout | 0 | +| Binlog_snapshot_file | mysql-bin.000002 | +| Binlog_snapshot_position | 1806 | +| Binlog_bytes_written | 1842 | +| Binlog_cache_disk_use | 0 | +| Binlog_cache_use | 0 | +| Binlog_stmt_cache_disk_use | 0 | +| Binlog_stmt_cache_use | 0 | +| Busy_time | 0.000000 | +| Bytes_received | 81392 | +| Bytes_sent | 56794 | +| Column_compressions | 0 | +| Column_decompressions | 0 | +| Com_admin_commands | 0 | +| Com_alter_db | 0 | +| Com_alter_db_upgrade | 0 | +| Com_alter_event | 0 | +| Com_alter_function | 0 | +| Com_alter_procedure | 0 | +| Com_alter_server | 0 | +| Com_alter_sequence | 0 | +| Com_alter_table | 0 | +| Com_alter_user | 0 | +| Com_analyze | 0 | +| Com_assign_to_keycache | 0 | +| Com_backup | 0 | +| Com_backup_lock | 0 | +| Com_begin | 0 | +| Com_binlog | 0 | +| Com_call_procedure | 0 | +| Com_change_db | 0 | +| Com_change_master | 0 | +| Com_check | 0 | +| Com_checksum | 0 | +| Com_commit | 0 | +| Com_compound_sql | 0 | +| Com_create_db | 1 | +| Com_create_event | 0 | +| Com_create_function | 0 | +| Com_create_index | 0 | +| Com_create_package | 0 | +| Com_create_package_body | 0 | +| Com_create_procedure | 0 | +| Com_create_role | 0 | +| Com_create_sequence | 0 | +| Com_create_server | 0 | +| Com_create_table | 0 | +| Com_create_temporary_table | 0 | +| Com_create_trigger | 0 | +| Com_create_udf | 0 | +| Com_create_user | 3 | +| Com_create_view | 0 | +| Com_dealloc_sql | 0 | +| Com_delete | 0 | +| Com_delete_multi | 0 | +| Com_do | 0 | +| Com_drop_db | 0 | +| Com_drop_event | 0 | +| Com_drop_function | 0 | +| Com_drop_index | 0 | +| Com_drop_procedure | 0 | +| Com_drop_package | 0 | +| Com_drop_package_body | 0 | +| Com_drop_role | 0 | +| Com_drop_server | 0 | +| Com_drop_sequence | 0 | +| Com_drop_table | 0 | +| Com_drop_temporary_table | 0 | +| Com_drop_trigger | 0 | +| Com_drop_user | 0 | +| Com_drop_view | 0 | +| Com_empty_query | 0 | +| Com_execute_immediate | 0 | +| Com_execute_sql | 0 | +| Com_flush | 2 | +| Com_get_diagnostics | 0 | +| Com_grant | 3 | +| Com_grant_role | 0 | +| Com_ha_close | 0 | +| Com_ha_open | 0 | +| Com_ha_read | 0 | +| Com_help | 0 | +| Com_insert | 0 | +| Com_insert_select | 0 | +| Com_install_plugin | 0 | +| Com_kill | 0 | +| Com_load | 0 | +| Com_lock_tables | 0 | +| Com_optimize | 0 | +| Com_preload_keys | 0 | +| Com_prepare_sql | 0 | +| Com_purge | 0 | +| Com_purge_before_date | 0 | +| Com_release_savepoint | 0 | +| Com_rename_table | 0 | +| Com_rename_user | 0 | +| Com_repair | 0 | +| Com_replace | 0 | +| Com_replace_select | 0 | +| Com_reset | 0 | +| Com_resignal | 0 | +| Com_revoke | 0 | +| Com_revoke_all | 0 | +| Com_revoke_role | 0 | +| Com_rollback | 0 | +| Com_rollback_to_savepoint | 0 | +| Com_savepoint | 0 | +| Com_select | 6 | +| Com_set_option | 0 | +| Com_show_authors | 0 | +| Com_show_binlog_events | 0 | +| Com_show_binlogs | 0 | +| Com_show_charsets | 0 | +| Com_show_collations | 0 | +| Com_show_contributors | 0 | +| Com_show_create_db | 0 | +| Com_show_create_event | 0 | +| Com_show_create_func | 0 | +| Com_show_create_package | 0 | +| Com_show_create_package_body | 0 | +| Com_show_create_proc | 0 | +| Com_show_create_table | 0 | +| Com_show_create_trigger | 0 | +| Com_show_create_user | 0 | +| Com_show_databases | 0 | +| Com_show_engine_logs | 0 | +| Com_show_engine_mutex | 0 | +| Com_show_engine_status | 0 | +| Com_show_errors | 0 | +| Com_show_events | 0 | +| Com_show_explain | 0 | +| Com_show_fields | 0 | +| Com_show_function_status | 0 | +| Com_show_generic | 0 | +| Com_show_grants | 0 | +| Com_show_keys | 0 | +| Com_show_binlog_status | 0 | +| Com_show_open_tables | 0 | +| Com_show_package_status | 0 | +| Com_show_package_body_status | 0 | +| Com_show_plugins | 0 | +| Com_show_privileges | 0 | +| Com_show_procedure_status | 0 | +| Com_show_processlist | 0 | +| Com_show_profile | 0 | +| Com_show_profiles | 0 | +| Com_show_relaylog_events | 0 | +| Com_show_slave_hosts | 0 | +| Com_show_slave_status | 14 | +| Com_show_status | 2 | +| Com_show_storage_engines | 0 | +| Com_show_table_status | 0 | +| Com_show_tables | 0 | +| Com_show_triggers | 0 | +| Com_show_variables | 0 | +| Com_show_warnings | 0 | +| Com_shutdown | 0 | +| Com_signal | 0 | +| Com_start_all_slaves | 0 | +| Com_start_slave | 0 | +| Com_stmt_close | 0 | +| Com_stmt_execute | 0 | +| Com_stmt_fetch | 0 | +| Com_stmt_prepare | 0 | +| Com_stmt_reprepare | 0 | +| Com_stmt_reset | 0 | +| Com_stmt_send_long_data | 0 | +| Com_stop_all_slaves | 0 | +| Com_stop_slave | 0 | +| Com_truncate | 0 | +| Com_uninstall_plugin | 0 | +| Com_unlock_tables | 0 | +| Com_update | 0 | +| Com_update_multi | 0 | +| Com_xa_commit | 0 | +| Com_xa_end | 0 | +| Com_xa_prepare | 0 | +| Com_xa_recover | 0 | +| Com_xa_rollback | 0 | +| Com_xa_start | 0 | +| Compression | OFF | +| Connection_errors_accept | 0 | +| Connection_errors_internal | 0 | +| Connection_errors_max_connections | 0 | +| Connection_errors_peer_address | 0 | +| Connection_errors_select | 0 | +| Connection_errors_tcpwrap | 0 | +| Connections | 12 | +| Cpu_time | 0.000000 | +| Created_tmp_disk_tables | 0 | +| Created_tmp_files | 5 | +| Created_tmp_tables | 2 | +| Delayed_errors | 0 | +| Delayed_insert_threads | 0 | +| Delayed_writes | 0 | +| Delete_scan | 0 | +| Empty_queries | 0 | +| Executed_events | 0 | +| Executed_triggers | 0 | +| Feature_application_time_periods | 0 | +| Feature_check_constraint | 1 | +| Feature_custom_aggregate_functions | 0 | +| Feature_delay_key_write | 0 | +| Feature_dynamic_columns | 0 | +| Feature_fulltext | 0 | +| Feature_gis | 0 | +| Feature_insert_returning | 0 | +| Feature_invisible_columns | 0 | +| Feature_json | 1 | +| Feature_locale | 0 | +| Feature_subquery | 0 | +| Feature_system_versioning | 0 | +| Feature_timezone | 0 | +| Feature_trigger | 0 | +| Feature_window_functions | 0 | +| Feature_xml | 0 | +| Handler_commit | 30 | +| Handler_delete | 0 | +| Handler_discover | 0 | +| Handler_external_lock | 0 | +| Handler_icp_attempts | 0 | +| Handler_icp_match | 0 | +| Handler_mrr_init | 0 | +| Handler_mrr_key_refills | 0 | +| Handler_mrr_rowid_refills | 0 | +| Handler_prepare | 0 | +| Handler_read_first | 7 | +| Handler_read_key | 7 | +| Handler_read_last | 0 | +| Handler_read_next | 3 | +| Handler_read_prev | 0 | +| Handler_read_retry | 0 | +| Handler_read_rnd | 0 | +| Handler_read_rnd_deleted | 0 | +| Handler_read_rnd_next | 626 | +| Handler_rollback | 0 | +| Handler_savepoint | 0 | +| Handler_savepoint_rollback | 0 | +| Handler_tmp_delete | 0 | +| Handler_tmp_update | 0 | +| Handler_tmp_write | 568 | +| Handler_update | 3 | +| Handler_write | 13 | +| Innodb_adaptive_hash_hash_searches | 0 | +| Innodb_adaptive_hash_non_hash_searches | 0 | +| Innodb_background_log_sync | 52300 | +| Innodb_buffer_pool_dump_status | | +| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 220817 21:14:57 | +| Innodb_buffer_pool_resize_status | | +| Innodb_buffer_pool_load_incomplete | OFF | +| Innodb_buffer_pool_pages_data | 309 | +| Innodb_buffer_pool_bytes_data | 5062656 | +| Innodb_buffer_pool_pages_dirty | 29 | +| Innodb_buffer_pool_bytes_dirty | 475136 | +| Innodb_buffer_pool_pages_flushed | 0 | +| Innodb_buffer_pool_pages_free | 7755 | +| Innodb_buffer_pool_pages_made_not_young | 0 | +| Innodb_buffer_pool_pages_made_young | 0 | +| Innodb_buffer_pool_pages_misc | 0 | +| Innodb_buffer_pool_pages_old | 0 | +| Innodb_buffer_pool_pages_total | 8064 | +| Innodb_buffer_pool_pages_lru_flushed | 0 | +| Innodb_buffer_pool_pages_lru_freed | 0 | +| Innodb_buffer_pool_read_ahead_rnd | 0 | +| Innodb_buffer_pool_read_ahead | 0 | +| Innodb_buffer_pool_read_ahead_evicted | 0 | +| Innodb_buffer_pool_read_requests | 1911 | +| Innodb_buffer_pool_reads | 171 | +| Innodb_buffer_pool_wait_free | 0 | +| Innodb_buffer_pool_write_requests | 148 | +| Innodb_checkpoint_age | 6097 | +| Innodb_checkpoint_max_age | 80819529 | +| Innodb_data_fsyncs | 17 | +| Innodb_data_pending_fsyncs | 0 | +| Innodb_data_pending_reads | 0 | +| Innodb_data_pending_writes | 0 | +| Innodb_data_read | 2801664 | +| Innodb_data_reads | 185 | +| Innodb_data_writes | 16 | +| Innodb_data_written | 0 | +| Innodb_dblwr_pages_written | 0 | +| Innodb_dblwr_writes | 0 | +| Innodb_deadlocks | 0 | +| Innodb_history_list_length | 0 | +| Innodb_ibuf_discarded_delete_marks | 0 | +| Innodb_ibuf_discarded_deletes | 0 | +| Innodb_ibuf_discarded_inserts | 0 | +| Innodb_ibuf_free_list | 0 | +| Innodb_ibuf_merged_delete_marks | 0 | +| Innodb_ibuf_merged_deletes | 0 | +| Innodb_ibuf_merged_inserts | 0 | +| Innodb_ibuf_merges | 0 | +| Innodb_ibuf_segment_size | 2 | +| Innodb_ibuf_size | 1 | +| Innodb_log_waits | 0 | +| Innodb_log_write_requests | 109 | +| Innodb_log_writes | 15 | +| Innodb_lsn_current | 52826 | +| Innodb_lsn_flushed | 52826 | +| Innodb_lsn_last_checkpoint | 46729 | +| Innodb_master_thread_active_loops | 0 | +| Innodb_master_thread_idle_loops | 52301 | +| Innodb_max_trx_id | 37 | +| Innodb_mem_adaptive_hash | 0 | +| Innodb_mem_dictionary | 855336 | +| Innodb_os_log_written | 6097 | +| Innodb_page_size | 16384 | +| Innodb_pages_created | 138 | +| Innodb_pages_read | 171 | +| Innodb_pages_written | 0 | +| Innodb_row_lock_current_waits | 0 | +| Innodb_row_lock_time | 0 | +| Innodb_row_lock_time_avg | 0 | +| Innodb_row_lock_time_max | 0 | +| Innodb_row_lock_waits | 0 | +| Innodb_rows_deleted | 0 | +| Innodb_rows_inserted | 0 | +| Innodb_rows_read | 0 | +| Innodb_rows_updated | 0 | +| Innodb_system_rows_deleted | 0 | +| Innodb_system_rows_inserted | 9 | +| Innodb_system_rows_read | 0 | +| Innodb_system_rows_updated | 0 | +| Innodb_num_open_files | 6 | +| Innodb_truncated_status_writes | 0 | +| Innodb_available_undo_logs | 128 | +| Innodb_undo_truncations | 0 | +| Innodb_page_compression_saved | 0 | +| Innodb_num_pages_page_compressed | 0 | +| Innodb_num_page_compressed_trim_op | 0 | +| Innodb_num_pages_page_decompressed | 0 | +| Innodb_num_pages_page_compression_error | 0 | +| Innodb_num_pages_encrypted | 0 | +| Innodb_num_pages_decrypted | 0 | +| Innodb_have_lz4 | OFF | +| Innodb_have_lzo | OFF | +| Innodb_have_lzma | OFF | +| Innodb_have_bzip2 | OFF | +| Innodb_have_snappy | OFF | +| Innodb_have_punch_hole | ON | +| Innodb_defragment_compression_failures | 0 | +| Innodb_defragment_failures | 0 | +| Innodb_defragment_count | 0 | +| Innodb_instant_alter_column | 0 | +| Innodb_onlineddl_rowlog_rows | 0 | +| Innodb_onlineddl_rowlog_pct_used | 0 | +| Innodb_onlineddl_pct_progress | 0 | +| Innodb_secondary_index_triggered_cluster_reads | 0 | +| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 | +| Innodb_encryption_rotation_pages_read_from_cache | 0 | +| Innodb_encryption_rotation_pages_read_from_disk | 0 | +| Innodb_encryption_rotation_pages_modified | 0 | +| Innodb_encryption_rotation_pages_flushed | 0 | +| Innodb_encryption_rotation_estimated_iops | 0 | +| Innodb_encryption_n_merge_blocks_encrypted | 0 | +| Innodb_encryption_n_merge_blocks_decrypted | 0 | +| Innodb_encryption_n_rowlog_blocks_encrypted | 0 | +| Innodb_encryption_n_rowlog_blocks_decrypted | 0 | +| Innodb_encryption_n_temp_blocks_encrypted | 0 | +| Innodb_encryption_n_temp_blocks_decrypted | 0 | +| Innodb_encryption_num_key_requests | 0 | +| Key_blocks_not_flushed | 0 | +| Key_blocks_unused | 107163 | +| Key_blocks_used | 0 | +| Key_blocks_warm | 0 | +| Key_read_requests | 0 | +| Key_reads | 0 | +| Key_write_requests | 0 | +| Key_writes | 0 | +| Last_query_cost | 0.000000 | +| Master_gtid_wait_count | 0 | +| Master_gtid_wait_time | 0 | +| Master_gtid_wait_timeouts | 0 | +| Max_statement_time_exceeded | 0 | +| Max_used_connections | 1 | +| Memory_used | 35982280 | +| Memory_used_initial | 35441456 | +| Not_flushed_delayed_rows | 0 | +| Open_files | 29 | +| Open_streams | 4 | +| Open_table_definitions | 17 | +| Open_tables | 10 | +| Opened_files | 100 | +| Opened_plugin_libraries | 0 | +| Opened_table_definitions | 16 | +| Opened_tables | 16 | +| Opened_views | 0 | +| Performance_schema_accounts_lost | 0 | +| Performance_schema_cond_classes_lost | 0 | +| Performance_schema_cond_instances_lost | 0 | +| Performance_schema_digest_lost | 0 | +| Performance_schema_file_classes_lost | 0 | +| Performance_schema_file_handles_lost | 0 | +| Performance_schema_file_instances_lost | 0 | +| Performance_schema_hosts_lost | 0 | +| Performance_schema_index_stat_lost | 0 | +| Performance_schema_locker_lost | 0 | +| Performance_schema_memory_classes_lost | 0 | +| Performance_schema_metadata_lock_lost | 0 | +| Performance_schema_mutex_classes_lost | 0 | +| Performance_schema_mutex_instances_lost | 0 | +| Performance_schema_nested_statement_lost | 0 | +| Performance_schema_prepared_statements_lost | 0 | +| Performance_schema_program_lost | 0 | +| Performance_schema_rwlock_classes_lost | 0 | +| Performance_schema_rwlock_instances_lost | 0 | +| Performance_schema_session_connect_attrs_lost | 0 | +| Performance_schema_socket_classes_lost | 0 | +| Performance_schema_socket_instances_lost | 0 | +| Performance_schema_stage_classes_lost | 0 | +| Performance_schema_statement_classes_lost | 0 | +| Performance_schema_table_handles_lost | 0 | +| Performance_schema_table_instances_lost | 0 | +| Performance_schema_table_lock_stat_lost | 0 | +| Performance_schema_thread_classes_lost | 0 | +| Performance_schema_thread_instances_lost | 0 | +| Performance_schema_users_lost | 0 | +| Prepared_stmt_count | 0 | +| Qcache_free_blocks | 1 | +| Qcache_free_memory | 1031272 | +| Qcache_hits | 0 | +| Qcache_inserts | 0 | +| Qcache_lowmem_prunes | 0 | +| Qcache_not_cached | 0 | +| Qcache_queries_in_cache | 0 | +| Qcache_total_blocks | 1 | +| Queries | 33 | +| Questions | 24 | +| Resultset_metadata_skipped | 0 | +| Rows_read | 36 | +| Rows_sent | 571 | +| Rows_tmp_read | 565 | +| Rpl_semi_sync_master_clients | 0 | +| Rpl_semi_sync_master_get_ack | 0 | +| Rpl_semi_sync_master_net_avg_wait_time | 0 | +| Rpl_semi_sync_master_net_wait_time | 0 | +| Rpl_semi_sync_master_net_waits | 0 | +| Rpl_semi_sync_master_no_times | 0 | +| Rpl_semi_sync_master_no_tx | 0 | +| Rpl_semi_sync_master_request_ack | 0 | +| Rpl_semi_sync_master_status | OFF | +| Rpl_semi_sync_master_timefunc_failures | 0 | +| Rpl_semi_sync_master_tx_avg_wait_time | 0 | +| Rpl_semi_sync_master_tx_wait_time | 0 | +| Rpl_semi_sync_master_tx_waits | 0 | +| Rpl_semi_sync_master_wait_pos_backtraverse | 0 | +| Rpl_semi_sync_master_wait_sessions | 0 | +| Rpl_semi_sync_master_yes_tx | 0 | +| Rpl_semi_sync_slave_send_ack | 0 | +| Rpl_semi_sync_slave_status | OFF | +| Rpl_status | AUTH_MASTER | +| Rpl_transactions_multi_engine | 0 | +| Select_full_join | 0 | +| Select_full_range_join | 0 | +| Select_range | 0 | +| Select_range_check | 0 | +| Select_scan | 2 | +| Slave_connections | 0 | +| Slave_heartbeat_period | 30.000 | +| Slave_open_temp_tables | 0 | +| Slave_received_heartbeats | 1743 | +| Slave_retried_transactions | 0 | +| Slave_running | ON | +| Slave_skipped_errors | 0 | +| Slaves_connected | 0 | +| Slaves_running | 1 | +| Slow_launch_threads | 0 | +| Slow_queries | 0 | +| Sort_merge_passes | 0 | +| Sort_priority_queue_sorts | 0 | +| Sort_range | 0 | +| Sort_rows | 0 | +| Sort_scan | 0 | +| Ssl_accept_renegotiates | 0 | +| Ssl_accepts | 0 | +| Ssl_callback_cache_hits | 0 | +| Ssl_cipher | | +| Ssl_cipher_list | | +| Ssl_client_connects | 0 | +| Ssl_connect_renegotiates | 0 | +| Ssl_ctx_verify_depth | 0 | +| Ssl_ctx_verify_mode | 0 | +| Ssl_default_timeout | 0 | +| Ssl_finished_accepts | 0 | +| Ssl_finished_connects | 0 | +| Ssl_server_not_after | | +| Ssl_server_not_before | | +| Ssl_session_cache_hits | 0 | +| Ssl_session_cache_misses | 0 | +| Ssl_session_cache_mode | NONE | +| Ssl_session_cache_overflows | 0 | +| Ssl_session_cache_size | 0 | +| Ssl_session_cache_timeouts | 0 | +| Ssl_sessions_reused | 0 | +| Ssl_used_session_cache_entries | 0 | +| Ssl_verify_depth | 0 | +| Ssl_verify_mode | 0 | +| Ssl_version | | +| Subquery_cache_hit | 0 | +| Subquery_cache_miss | 0 | +| Syncs | 56 | +| Table_locks_immediate | 60 | +| Table_locks_waited | 0 | +| Table_open_cache_active_instances | 1 | +| Table_open_cache_hits | 54 | +| Table_open_cache_misses | 16 | +| Table_open_cache_overflows | 0 | +| Tc_log_max_pages_used | 0 | +| Tc_log_page_size | 0 | +| Tc_log_page_waits | 0 | +| Threadpool_idle_threads | 0 | +| Threadpool_threads | 0 | +| Threads_cached | 0 | +| Threads_connected | 1 | +| Threads_created | 2 | +| Threads_running | 3 | +| Transactions_gtid_foreign_engine | 0 | +| Transactions_multi_engine | 0 | +| Update_scan | 0 | +| Uptime | 52310 | +| Uptime_since_flush_status | 52310 | +| wsrep | 0 | +| wsrep_applier_thread_count | 0 | +| wsrep_cluster_capabilities | | +| wsrep_cluster_conf_id | 18446744073709551615 | +| wsrep_cluster_size | 0 | +| wsrep_cluster_state_uuid | | +| wsrep_cluster_status | Disconnected | +| wsrep_connected | OFF | +| wsrep_local_bf_aborts | 0 | +| wsrep_local_index | 18446744073709551615 | +| wsrep_provider_capabilities | | +| wsrep_provider_name | | +| wsrep_provider_vendor | | +| wsrep_provider_version | | +| wsrep_ready | OFF | +| wsrep_rollbacker_thread_count | 0 | +| wsrep_thread_count | 0 | ++--------------------------------------------------------+--------------------------------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/global_variables.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/global_variables.txt new file mode 100644 index 000000000..96591afdf --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/global_variables.txt @@ -0,0 +1,8 @@ ++--------------------+-------+ +| Variable_name | Value | ++--------------------+-------+ +| log_bin | ON | +| max_connections | 151 | +| performance_schema | ON | +| table_open_cache | 2000 | ++--------------------+-------+ diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/process_list.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/process_list.txt new file mode 100644 index 000000000..a44ce5e70 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/process_list.txt @@ -0,0 +1,6 @@ ++------+---------+ +| time | user | ++------+---------+ +| 1 | netdata | +| 9 | root | ++------+---------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/user_statistics.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/user_statistics.txt new file mode 100644 index 000000000..7a44b8b5a --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/user_statistics.txt @@ -0,0 +1,6 @@ ++---------+-------------------+------------------------+----------------+---------------------+---------------------+----------------+------------+----------------------+-----------+-----------+--------------+---------------+--------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+-----------------------------+ +| User | Total_connections | Concurrent_connections | Connected_time | Busy_time | Cpu_time | Bytes_received | Bytes_sent | Binlog_bytes_written | Rows_read | Rows_sent | Rows_deleted | Rows_inserted | Rows_updated | Select_commands | Update_commands | Other_commands | Commit_transactions | Rollback_transactions | Denied_connections | Lost_connections | Access_denied | Empty_queries | Total_ssl_connections | Max_statement_time_exceeded | ++---------+-------------------+------------------------+----------------+---------------------+---------------------+----------------+------------+----------------------+-----------+-----------+--------------+---------------+--------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+-----------------------------+ +| root | 1 | 0 | 9 | 0.000156 | 0.0001541 | 25 | 2799 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| netdata | 1 | 0 | 32 | 0.09262200000000004 | 0.07723410000000001 | 13440 | 105432 | 0 | 0 | 99 | 0 | 0 | 0 | 33 | 0 | 0 | 0 | 0 | 49698 | 0 | 33 | 66 | 0 | 0 | ++---------+-------------------+------------------------+----------------+---------------------+---------------------+----------------+------------+----------------------+-----------+-----------+--------------+---------------+--------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+-----------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/version.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/version.txt new file mode 100644 index 000000000..2e7ca5b02 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v10.8.4/version.txt @@ -0,0 +1,6 @@ ++-----------------+---------------------+ +| Variable_name | Value | ++-----------------+---------------------+ +| version | 10.8.4-MariaDB | +| version_comment | Source distribution | ++-----------------+---------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/global_status.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/global_status.txt new file mode 100644 index 000000000..7c75f0619 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/global_status.txt @@ -0,0 +1,423 @@ ++------------------------------------------+-------------+ +| Variable_name | Value | ++------------------------------------------+-------------+ +| Aborted_clients | 0 | +| Aborted_connects | 0 | +| Access_denied_errors | 0 | +| Aria_pagecache_blocks_not_flushed | 0 | +| Aria_pagecache_blocks_unused | 15737 | +| Aria_pagecache_blocks_used | 0 | +| Aria_pagecache_read_requests | 0 | +| Aria_pagecache_reads | 0 | +| Aria_pagecache_write_requests | 0 | +| Aria_pagecache_writes | 0 | +| Aria_transaction_log_syncs | 0 | +| Binlog_commits | 0 | +| Binlog_group_commits | 0 | +| Binlog_snapshot_file | | +| Binlog_snapshot_position | 0 | +| Binlog_bytes_written | 0 | +| Binlog_cache_disk_use | 0 | +| Binlog_cache_use | 0 | +| Binlog_stmt_cache_disk_use | 0 | +| Binlog_stmt_cache_use | 0 | +| Busy_time | 0.000000 | +| Bytes_received | 639 | +| Bytes_sent | 41620 | +| Com_admin_commands | 0 | +| Com_alter_db | 0 | +| Com_alter_db_upgrade | 0 | +| Com_alter_event | 0 | +| Com_alter_function | 0 | +| Com_alter_procedure | 0 | +| Com_alter_server | 0 | +| Com_alter_table | 0 | +| Com_alter_tablespace | 0 | +| Com_analyze | 0 | +| Com_assign_to_keycache | 0 | +| Com_begin | 0 | +| Com_binlog | 0 | +| Com_call_procedure | 0 | +| Com_change_db | 0 | +| Com_change_master | 0 | +| Com_check | 0 | +| Com_checksum | 0 | +| Com_commit | 0 | +| Com_create_db | 0 | +| Com_create_event | 0 | +| Com_create_function | 0 | +| Com_create_index | 0 | +| Com_create_procedure | 0 | +| Com_create_server | 0 | +| Com_create_table | 0 | +| Com_create_trigger | 0 | +| Com_create_udf | 0 | +| Com_create_user | 0 | +| Com_create_view | 0 | +| Com_dealloc_sql | 0 | +| Com_delete | 0 | +| Com_delete_multi | 0 | +| Com_do | 0 | +| Com_drop_db | 0 | +| Com_drop_event | 0 | +| Com_drop_function | 0 | +| Com_drop_index | 0 | +| Com_drop_procedure | 0 | +| Com_drop_server | 0 | +| Com_drop_table | 0 | +| Com_drop_trigger | 0 | +| Com_drop_user | 0 | +| Com_drop_view | 0 | +| Com_empty_query | 0 | +| Com_execute_sql | 0 | +| Com_flush | 0 | +| Com_grant | 0 | +| Com_ha_close | 0 | +| Com_ha_open | 0 | +| Com_ha_read | 0 | +| Com_help | 0 | +| Com_insert | 0 | +| Com_insert_select | 0 | +| Com_install_plugin | 0 | +| Com_kill | 0 | +| Com_load | 0 | +| Com_lock_tables | 0 | +| Com_optimize | 0 | +| Com_preload_keys | 0 | +| Com_prepare_sql | 0 | +| Com_purge | 0 | +| Com_purge_before_date | 0 | +| Com_release_savepoint | 0 | +| Com_rename_table | 0 | +| Com_rename_user | 0 | +| Com_repair | 0 | +| Com_replace | 0 | +| Com_replace_select | 0 | +| Com_reset | 0 | +| Com_resignal | 0 | +| Com_revoke | 0 | +| Com_revoke_all | 0 | +| Com_rollback | 0 | +| Com_rollback_to_savepoint | 0 | +| Com_savepoint | 0 | +| Com_select | 4 | +| Com_set_option | 0 | +| Com_show_authors | 0 | +| Com_show_binlog_events | 0 | +| Com_show_binlogs | 0 | +| Com_show_charsets | 0 | +| Com_show_client_statistics | 0 | +| Com_show_collations | 0 | +| Com_show_contributors | 0 | +| Com_show_create_db | 0 | +| Com_show_create_event | 0 | +| Com_show_create_func | 0 | +| Com_show_create_proc | 0 | +| Com_show_create_table | 0 | +| Com_show_create_trigger | 0 | +| Com_show_databases | 0 | +| Com_show_engine_logs | 0 | +| Com_show_engine_mutex | 0 | +| Com_show_engine_status | 0 | +| Com_show_errors | 0 | +| Com_show_events | 0 | +| Com_show_fields | 0 | +| Com_show_function_status | 0 | +| Com_show_grants | 0 | +| Com_show_index_statistics | 0 | +| Com_show_keys | 0 | +| Com_show_master_status | 0 | +| Com_show_open_tables | 0 | +| Com_show_plugins | 0 | +| Com_show_privileges | 0 | +| Com_show_procedure_status | 0 | +| Com_show_processlist | 0 | +| Com_show_profile | 0 | +| Com_show_profiles | 0 | +| Com_show_relaylog_events | 0 | +| Com_show_slave_hosts | 0 | +| Com_show_slave_status | 0 | +| Com_show_status | 1 | +| Com_show_storage_engines | 0 | +| Com_show_table_statistics | 0 | +| Com_show_table_status | 0 | +| Com_show_tables | 0 | +| Com_show_triggers | 0 | +| Com_show_user_statistics | 0 | +| Com_show_variables | 4 | +| Com_show_warnings | 0 | +| Com_signal | 0 | +| Com_slave_start | 0 | +| Com_slave_stop | 0 | +| Com_stmt_close | 0 | +| Com_stmt_execute | 0 | +| Com_stmt_fetch | 0 | +| Com_stmt_prepare | 0 | +| Com_stmt_reprepare | 0 | +| Com_stmt_reset | 0 | +| Com_stmt_send_long_data | 0 | +| Com_truncate | 0 | +| Com_uninstall_plugin | 0 | +| Com_unlock_tables | 0 | +| Com_update | 0 | +| Com_update_multi | 0 | +| Com_xa_commit | 0 | +| Com_xa_end | 0 | +| Com_xa_prepare | 0 | +| Com_xa_recover | 0 | +| Com_xa_rollback | 0 | +| Com_xa_start | 0 | +| Compression | OFF | +| Connections | 4 | +| Cpu_time | 0.000000 | +| Created_tmp_disk_tables | 0 | +| Created_tmp_files | 6 | +| Created_tmp_tables | 5 | +| Delayed_errors | 0 | +| Delayed_insert_threads | 0 | +| Delayed_writes | 0 | +| Empty_queries | 0 | +| Executed_events | 0 | +| Executed_triggers | 0 | +| Feature_dynamic_columns | 0 | +| Feature_fulltext | 0 | +| Feature_gis | 0 | +| Feature_locale | 0 | +| Feature_subquery | 0 | +| Feature_timezone | 0 | +| Feature_trigger | 0 | +| Feature_xml | 0 | +| Flush_commands | 2 | +| Handler_commit | 0 | +| Handler_delete | 0 | +| Handler_discover | 0 | +| Handler_icp_attempts | 0 | +| Handler_icp_match | 0 | +| Handler_mrr_init | 0 | +| Handler_mrr_key_refills | 0 | +| Handler_mrr_rowid_refills | 0 | +| Handler_prepare | 0 | +| Handler_read_first | 0 | +| Handler_read_key | 0 | +| Handler_read_last | 0 | +| Handler_read_next | 0 | +| Handler_read_prev | 0 | +| Handler_read_rnd | 0 | +| Handler_read_rnd_deleted | 0 | +| Handler_read_rnd_next | 1264 | +| Handler_rollback | 0 | +| Handler_savepoint | 0 | +| Handler_savepoint_rollback | 0 | +| Handler_tmp_update | 0 | +| Handler_tmp_write | 1260 | +| Handler_update | 0 | +| Handler_write | 0 | +| Innodb_adaptive_hash_cells | 553229 | +| Innodb_adaptive_hash_hash_searches | 0 | +| Innodb_adaptive_hash_heap_buffers | 0 | +| Innodb_adaptive_hash_non_hash_searches | 19 | +| Innodb_background_log_sync | 1 | +| Innodb_buffer_pool_bytes_data | 2342912 | +| Innodb_buffer_pool_bytes_dirty | 0 | +| Innodb_buffer_pool_pages_data | 143 | +| Innodb_buffer_pool_pages_dirty | 0 | +| Innodb_buffer_pool_pages_flushed | 0 | +| Innodb_buffer_pool_pages_free | 16240 | +| Innodb_buffer_pool_pages_LRU_flushed | 0 | +| Innodb_buffer_pool_pages_made_not_young | 0 | +| Innodb_buffer_pool_pages_made_young | 0 | +| Innodb_buffer_pool_pages_misc | 0 | +| Innodb_buffer_pool_pages_old | 0 | +| Innodb_buffer_pool_pages_total | 16383 | +| Innodb_buffer_pool_read_ahead | 0 | +| Innodb_buffer_pool_read_ahead_evicted | 0 | +| Innodb_buffer_pool_read_ahead_rnd | 0 | +| Innodb_buffer_pool_read_requests | 459 | +| Innodb_buffer_pool_reads | 144 | +| Innodb_buffer_pool_wait_free | 0 | +| Innodb_buffer_pool_write_requests | 0 | +| Innodb_checkpoint_age | 0 | +| Innodb_checkpoint_max_age | 7782360 | +| Innodb_checkpoint_target_age | 7539162 | +| Innodb_current_row_locks | 0 | +| Innodb_data_fsyncs | 3 | +| Innodb_data_pending_fsyncs | 0 | +| Innodb_data_pending_reads | 0 | +| Innodb_data_pending_writes | 0 | +| Innodb_data_read | 4542976 | +| Innodb_data_reads | 155 | +| Innodb_data_writes | 3 | +| Innodb_data_written | 1536 | +| Innodb_dblwr_pages_written | 0 | +| Innodb_dblwr_writes | 0 | +| Innodb_deadlocks | 0 | +| Innodb_descriptors_memory | 8000 | +| Innodb_dict_tables | 8 | +| Innodb_have_atomic_builtins | ON | +| Innodb_history_list_length | 0 | +| Innodb_ibuf_discarded_delete_marks | 0 | +| Innodb_ibuf_discarded_deletes | 0 | +| Innodb_ibuf_discarded_inserts | 0 | +| Innodb_ibuf_free_list | 0 | +| Innodb_ibuf_merged_delete_marks | 0 | +| Innodb_ibuf_merged_deletes | 0 | +| Innodb_ibuf_merged_inserts | 0 | +| Innodb_ibuf_merges | 0 | +| Innodb_ibuf_segment_size | 2 | +| Innodb_ibuf_size | 1 | +| Innodb_log_waits | 0 | +| Innodb_log_write_requests | 0 | +| Innodb_log_writes | 1 | +| Innodb_lsn_current | 1597945 | +| Innodb_lsn_flushed | 1597945 | +| Innodb_lsn_last_checkpoint | 1597945 | +| Innodb_master_thread_1_second_loops | 1 | +| Innodb_master_thread_10_second_loops | 0 | +| Innodb_master_thread_background_loops | 1 | +| Innodb_master_thread_main_flush_loops | 1 | +| Innodb_master_thread_sleeps | 1 | +| Innodb_max_trx_id | 1280 | +| Innodb_mem_adaptive_hash | 4430048 | +| Innodb_mem_dictionary | 1146964 | +| Innodb_mem_total | 275513344 | +| Innodb_mutex_os_waits | 0 | +| Innodb_mutex_spin_rounds | 2 | +| Innodb_mutex_spin_waits | 1 | +| Innodb_oldest_view_low_limit_trx_id | 1280 | +| Innodb_os_log_fsyncs | 3 | +| Innodb_os_log_pending_fsyncs | 0 | +| Innodb_os_log_pending_writes | 0 | +| Innodb_os_log_written | 512 | +| Innodb_page_size | 16384 | +| Innodb_pages_created | 0 | +| Innodb_pages_read | 143 | +| Innodb_pages_written | 0 | +| Innodb_purge_trx_id | 0 | +| Innodb_purge_undo_no | 0 | +| Innodb_read_views_memory | 88 | +| Innodb_row_lock_current_waits | 0 | +| Innodb_row_lock_time | 0 | +| Innodb_row_lock_time_avg | 0 | +| Innodb_row_lock_time_max | 0 | +| Innodb_row_lock_waits | 0 | +| Innodb_rows_deleted | 0 | +| Innodb_rows_inserted | 0 | +| Innodb_rows_read | 0 | +| Innodb_rows_updated | 0 | +| Innodb_s_lock_os_waits | 2 | +| Innodb_s_lock_spin_rounds | 60 | +| Innodb_s_lock_spin_waits | 2 | +| Innodb_truncated_status_writes | 0 | +| Innodb_x_lock_os_waits | 0 | +| Innodb_x_lock_spin_rounds | 0 | +| Innodb_x_lock_spin_waits | 0 | +| Key_blocks_not_flushed | 0 | +| Key_blocks_unused | 107171 | +| Key_blocks_used | 0 | +| Key_blocks_warm | 0 | +| Key_read_requests | 0 | +| Key_reads | 0 | +| Key_write_requests | 0 | +| Key_writes | 0 | +| Last_query_cost | 0.000000 | +| Max_used_connections | 1 | +| Not_flushed_delayed_rows | 0 | +| Open_files | 21 | +| Open_streams | 0 | +| Open_table_definitions | 33 | +| Open_tables | 26 | +| Opened_files | 84 | +| Opened_table_definitions | 0 | +| Opened_tables | 0 | +| Opened_views | 0 | +| Performance_schema_cond_classes_lost | 0 | +| Performance_schema_cond_instances_lost | 0 | +| Performance_schema_file_classes_lost | 0 | +| Performance_schema_file_handles_lost | 0 | +| Performance_schema_file_instances_lost | 0 | +| Performance_schema_locker_lost | 0 | +| Performance_schema_mutex_classes_lost | 0 | +| Performance_schema_mutex_instances_lost | 0 | +| Performance_schema_rwlock_classes_lost | 0 | +| Performance_schema_rwlock_instances_lost | 0 | +| Performance_schema_table_handles_lost | 0 | +| Performance_schema_table_instances_lost | 0 | +| Performance_schema_thread_classes_lost | 0 | +| Performance_schema_thread_instances_lost | 0 | +| Prepared_stmt_count | 0 | +| Qcache_free_blocks | 1 | +| Qcache_free_memory | 67091120 | +| Qcache_hits | 0 | +| Qcache_inserts | 0 | +| Qcache_lowmem_prunes | 0 | +| Qcache_not_cached | 4 | +| Qcache_queries_in_cache | 0 | +| Qcache_total_blocks | 1 | +| Queries | 12 | +| Questions | 11 | +| Rows_read | 0 | +| Rows_sent | 1264 | +| Rows_tmp_read | 1260 | +| Rpl_status | AUTH_MASTER | +| Select_full_join | 0 | +| Select_full_range_join | 0 | +| Select_range | 0 | +| Select_range_check | 0 | +| Select_scan | 5 | +| Slave_heartbeat_period | 0.000 | +| Slave_open_temp_tables | 0 | +| Slave_received_heartbeats | 0 | +| Slave_retried_transactions | 0 | +| Slave_running | OFF | +| Slow_launch_threads | 0 | +| Slow_queries | 0 | +| Sort_merge_passes | 0 | +| Sort_range | 0 | +| Sort_rows | 0 | +| Sort_scan | 0 | +| Sphinx_error | | +| Sphinx_time | | +| Sphinx_total | | +| Sphinx_total_found | | +| Sphinx_word_count | | +| Sphinx_words | | +| Ssl_accept_renegotiates | 0 | +| Ssl_accepts | 0 | +| Ssl_callback_cache_hits | 0 | +| Ssl_cipher | | +| Ssl_cipher_list | | +| Ssl_client_connects | 0 | +| Ssl_connect_renegotiates | 0 | +| Ssl_ctx_verify_depth | 0 | +| Ssl_ctx_verify_mode | 0 | +| Ssl_default_timeout | 0 | +| Ssl_finished_accepts | 0 | +| Ssl_finished_connects | 0 | +| Ssl_session_cache_hits | 0 | +| Ssl_session_cache_misses | 0 | +| Ssl_session_cache_mode | NONE | +| Ssl_session_cache_overflows | 0 | +| Ssl_session_cache_size | 0 | +| Ssl_session_cache_timeouts | 0 | +| Ssl_sessions_reused | 0 | +| Ssl_used_session_cache_entries | 0 | +| Ssl_verify_depth | 0 | +| Ssl_verify_mode | 0 | +| Ssl_version | | +| Subquery_cache_hit | 0 | +| Subquery_cache_miss | 0 | +| Syncs | 0 | +| Table_locks_immediate | 36 | +| Table_locks_waited | 0 | +| Tc_log_max_pages_used | 0 | +| Tc_log_page_size | 0 | +| Tc_log_page_waits | 0 | +| Threadpool_idle_threads | 0 | +| Threadpool_threads | 0 | +| Threads_cached | 0 | +| Threads_connected | 1 | +| Threads_created | 1 | +| Threads_running | 1 | +| Uptime | 113 | +| Uptime_since_flush_status | 113 | ++------------------------------------------+-------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/global_variables.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/global_variables.txt new file mode 100644 index 000000000..5f0906eed --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/global_variables.txt @@ -0,0 +1,7 @@ ++------------------+-------+ +| Variable_name | Value | ++------------------+-------+ +| log_bin | OFF | +| max_connections | 100 | +| table_open_cache | 400 | ++------------------+-------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/process_list.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/process_list.txt new file mode 100644 index 000000000..a44ce5e70 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/process_list.txt @@ -0,0 +1,6 @@ ++------+---------+ +| time | user | ++------+---------+ +| 1 | netdata | +| 9 | root | ++------+---------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/version.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/version.txt new file mode 100644 index 000000000..de684279d --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mariadb/v5.5.64/version.txt @@ -0,0 +1,6 @@ ++-----------------+---------------------------------+ +| Variable_name | Value | ++-----------------+---------------------------------+ +| version | 5.5.64-MariaDB-1~trusty | +| version_comment | mariadb.org binary distribution | ++-----------------+---------------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/global_status.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/global_status.txt new file mode 100644 index 000000000..a4b2f2f93 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/global_status.txt @@ -0,0 +1,490 @@ ++-------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Variable_name | Value | ++-------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Aborted_clients | 0 | +| Aborted_connects | 0 | +| Acl_cache_items_count | 0 | +| Binlog_cache_disk_use | 0 | +| Binlog_cache_use | 6 | +| Binlog_stmt_cache_disk_use | 0 | +| Binlog_stmt_cache_use | 0 | +| Bytes_received | 5584 | +| Bytes_sent | 70700 | +| Com_admin_commands | 5 | +| Com_assign_to_keycache | 0 | +| Com_alter_db | 0 | +| Com_alter_event | 0 | +| Com_alter_function | 0 | +| Com_alter_instance | 0 | +| Com_alter_procedure | 0 | +| Com_alter_resource_group | 0 | +| Com_alter_server | 0 | +| Com_alter_table | 0 | +| Com_alter_tablespace | 0 | +| Com_alter_user | 2 | +| Com_alter_user_default_role | 0 | +| Com_analyze | 0 | +| Com_begin | 0 | +| Com_binlog | 0 | +| Com_call_procedure | 0 | +| Com_change_db | 1 | +| Com_change_master | 0 | +| Com_change_repl_filter | 0 | +| Com_change_replication_source | 0 | +| Com_check | 0 | +| Com_checksum | 0 | +| Com_clone | 0 | +| Com_commit | 0 | +| Com_create_db | 1 | +| Com_create_event | 0 | +| Com_create_function | 0 | +| Com_create_index | 0 | +| Com_create_procedure | 0 | +| Com_create_role | 0 | +| Com_create_server | 0 | +| Com_create_table | 35 | +| Com_create_resource_group | 0 | +| Com_create_trigger | 0 | +| Com_create_udf | 0 | +| Com_create_user | 2 | +| Com_create_view | 0 | +| Com_create_spatial_reference_system | 0 | +| Com_dealloc_sql | 0 | +| Com_delete | 0 | +| Com_delete_multi | 0 | +| Com_do | 0 | +| Com_drop_db | 0 | +| Com_drop_event | 0 | +| Com_drop_function | 0 | +| Com_drop_index | 0 | +| Com_drop_procedure | 0 | +| Com_drop_resource_group | 0 | +| Com_drop_role | 0 | +| Com_drop_server | 0 | +| Com_drop_spatial_reference_system | 0 | +| Com_drop_table | 0 | +| Com_drop_trigger | 0 | +| Com_drop_user | 0 | +| Com_drop_view | 0 | +| Com_empty_query | 0 | +| Com_execute_sql | 0 | +| Com_explain_other | 0 | +| Com_flush | 1 | +| Com_get_diagnostics | 0 | +| Com_grant | 2 | +| Com_grant_roles | 0 | +| Com_ha_close | 0 | +| Com_ha_open | 0 | +| Com_ha_read | 0 | +| Com_help | 0 | +| Com_import | 0 | +| Com_insert | 0 | +| Com_insert_select | 0 | +| Com_install_component | 0 | +| Com_install_plugin | 0 | +| Com_kill | 0 | +| Com_load | 0 | +| Com_lock_instance | 0 | +| Com_lock_tables | 0 | +| Com_optimize | 0 | +| Com_preload_keys | 0 | +| Com_prepare_sql | 0 | +| Com_purge | 0 | +| Com_purge_before_date | 0 | +| Com_release_savepoint | 0 | +| Com_rename_table | 0 | +| Com_rename_user | 0 | +| Com_repair | 0 | +| Com_replace | 0 | +| Com_replace_select | 0 | +| Com_reset | 0 | +| Com_resignal | 0 | +| Com_restart | 0 | +| Com_revoke | 0 | +| Com_revoke_all | 0 | +| Com_revoke_roles | 0 | +| Com_rollback | 0 | +| Com_rollback_to_savepoint | 0 | +| Com_savepoint | 0 | +| Com_select | 2 | +| Com_set_option | 4 | +| Com_set_password | 0 | +| Com_set_resource_group | 0 | +| Com_set_role | 0 | +| Com_signal | 0 | +| Com_show_binlog_events | 0 | +| Com_show_binlogs | 0 | +| Com_show_charsets | 0 | +| Com_show_collations | 0 | +| Com_show_create_db | 0 | +| Com_show_create_event | 0 | +| Com_show_create_func | 0 | +| Com_show_create_proc | 0 | +| Com_show_create_table | 0 | +| Com_show_create_trigger | 0 | +| Com_show_databases | 0 | +| Com_show_engine_logs | 0 | +| Com_show_engine_mutex | 0 | +| Com_show_engine_status | 0 | +| Com_show_events | 0 | +| Com_show_errors | 0 | +| Com_show_fields | 0 | +| Com_show_function_code | 0 | +| Com_show_function_status | 0 | +| Com_show_grants | 0 | +| Com_show_keys | 0 | +| Com_show_master_status | 0 | +| Com_show_open_tables | 0 | +| Com_show_plugins | 0 | +| Com_show_privileges | 0 | +| Com_show_procedure_code | 0 | +| Com_show_procedure_status | 0 | +| Com_show_processlist | 0 | +| Com_show_profile | 0 | +| Com_show_profiles | 0 | +| Com_show_relaylog_events | 0 | +| Com_show_replicas | 0 | +| Com_show_slave_hosts | 0 | +| Com_show_replica_status | 2 | +| Com_show_slave_status | 2 | +| Com_show_status | 5 | +| Com_show_storage_engines | 0 | +| Com_show_table_status | 0 | +| Com_show_tables | 0 | +| Com_show_triggers | 0 | +| Com_show_variables | 1 | +| Com_show_warnings | 0 | +| Com_show_create_user | 0 | +| Com_shutdown | 0 | +| Com_replica_start | 0 | +| Com_slave_start | 0 | +| Com_replica_stop | 0 | +| Com_slave_stop | 0 | +| Com_group_replication_start | 0 | +| Com_group_replication_stop | 0 | +| Com_stmt_execute | 0 | +| Com_stmt_close | 0 | +| Com_stmt_fetch | 0 | +| Com_stmt_prepare | 0 | +| Com_stmt_reset | 0 | +| Com_stmt_send_long_data | 0 | +| Com_truncate | 0 | +| Com_uninstall_component | 0 | +| Com_uninstall_plugin | 0 | +| Com_unlock_instance | 0 | +| Com_unlock_tables | 0 | +| Com_update | 0 | +| Com_update_multi | 0 | +| Com_xa_commit | 0 | +| Com_xa_end | 0 | +| Com_xa_prepare | 0 | +| Com_xa_recover | 0 | +| Com_xa_rollback | 0 | +| Com_xa_start | 0 | +| Com_stmt_reprepare | 0 | +| Connection_errors_accept | 0 | +| Connection_errors_internal | 0 | +| Connection_errors_max_connections | 0 | +| Connection_errors_peer_address | 0 | +| Connection_errors_select | 0 | +| Connection_errors_tcpwrap | 0 | +| Connections | 25 | +| Created_tmp_disk_tables | 0 | +| Created_tmp_files | 5 | +| Created_tmp_tables | 6 | +| Current_tls_ca | ca.pem | +| Current_tls_capath | | +| Current_tls_cert | server-cert.pem | +| Current_tls_cipher | | +| Current_tls_ciphersuites | | +| Current_tls_crl | | +| Current_tls_crlpath | | +| Current_tls_key | server-key.pem | +| Current_tls_version | TLSv1.2,TLSv1.3 | +| Delayed_errors | 0 | +| Delayed_insert_threads | 0 | +| Delayed_writes | 0 | +| Error_log_buffered_bytes | 2752 | +| Error_log_buffered_events | 15 | +| Error_log_expired_events | 0 | +| Error_log_latest_write | 1660827046947930 | +| Flush_commands | 3 | +| Global_connection_memory | 0 | +| Handler_commit | 720 | +| Handler_delete | 8 | +| Handler_discover | 0 | +| Handler_external_lock | 6779 | +| Handler_mrr_init | 0 | +| Handler_prepare | 24 | +| Handler_read_first | 50 | +| Handler_read_key | 1914 | +| Handler_read_last | 0 | +| Handler_read_next | 4303 | +| Handler_read_prev | 0 | +| Handler_read_rnd | 0 | +| Handler_read_rnd_next | 4723 | +| Handler_rollback | 1 | +| Handler_savepoint | 0 | +| Handler_savepoint_rollback | 0 | +| Handler_update | 373 | +| Handler_write | 1966 | +| Innodb_buffer_pool_dump_status | Dumping of buffer pool not started | +| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 220818 12:50:46 | +| Innodb_buffer_pool_resize_status | | +| Innodb_buffer_pool_pages_data | 1045 | +| Innodb_buffer_pool_bytes_data | 17121280 | +| Innodb_buffer_pool_pages_dirty | 0 | +| Innodb_buffer_pool_bytes_dirty | 0 | +| Innodb_buffer_pool_pages_flushed | 361 | +| Innodb_buffer_pool_pages_free | 7143 | +| Innodb_buffer_pool_pages_misc | 4 | +| Innodb_buffer_pool_pages_total | 8192 | +| Innodb_buffer_pool_read_ahead_rnd | 0 | +| Innodb_buffer_pool_read_ahead | 0 | +| Innodb_buffer_pool_read_ahead_evicted | 0 | +| Innodb_buffer_pool_read_requests | 16723 | +| Innodb_buffer_pool_reads | 878 | +| Innodb_buffer_pool_wait_free | 0 | +| Innodb_buffer_pool_write_requests | 2377 | +| Innodb_data_fsyncs | 255 | +| Innodb_data_pending_fsyncs | 0 | +| Innodb_data_pending_reads | 0 | +| Innodb_data_pending_writes | 0 | +| Innodb_data_read | 14453760 | +| Innodb_data_reads | 899 | +| Innodb_data_writes | 561 | +| Innodb_data_written | 6128128 | +| Innodb_dblwr_pages_written | 220 | +| Innodb_dblwr_writes | 58 | +| Innodb_redo_log_read_only | OFF | +| Innodb_redo_log_uuid | 1075899837 | +| Innodb_redo_log_checkpoint_lsn | 31758453 | +| Innodb_redo_log_current_lsn | 31758453 | +| Innodb_redo_log_flushed_to_disk_lsn | 31758453 | +| Innodb_redo_log_logical_size | 512 | +| Innodb_redo_log_physical_size | 3276800 | +| Innodb_redo_log_capacity_resized | 104857600 | +| Innodb_redo_log_resize_status | OK | +| Innodb_log_waits | 0 | +| Innodb_log_write_requests | 1062 | +| Innodb_log_writes | 116 | +| Innodb_os_log_fsyncs | 69 | +| Innodb_os_log_pending_fsyncs | 0 | +| Innodb_os_log_pending_writes | 0 | +| Innodb_os_log_written | 147968 | +| Innodb_page_size | 16384 | +| Innodb_pages_created | 168 | +| Innodb_pages_read | 877 | +| Innodb_pages_written | 361 | +| Innodb_redo_log_enabled | ON | +| Innodb_row_lock_current_waits | 0 | +| Innodb_row_lock_time | 0 | +| Innodb_row_lock_time_avg | 0 | +| Innodb_row_lock_time_max | 0 | +| Innodb_row_lock_waits | 0 | +| Innodb_rows_deleted | 0 | +| Innodb_rows_inserted | 0 | +| Innodb_rows_read | 0 | +| Innodb_rows_updated | 0 | +| Innodb_system_rows_deleted | 8 | +| Innodb_system_rows_inserted | 12 | +| Innodb_system_rows_read | 5134 | +| Innodb_system_rows_updated | 373 | +| Innodb_sampled_pages_read | 0 | +| Innodb_sampled_pages_skipped | 0 | +| Innodb_num_open_files | 15 | +| Innodb_truncated_status_writes | 0 | +| Innodb_undo_tablespaces_total | 2 | +| Innodb_undo_tablespaces_implicit | 2 | +| Innodb_undo_tablespaces_explicit | 0 | +| Innodb_undo_tablespaces_active | 2 | +| Key_blocks_not_flushed | 0 | +| Key_blocks_unused | 6698 | +| Key_blocks_used | 0 | +| Key_read_requests | 0 | +| Key_reads | 0 | +| Key_write_requests | 0 | +| Key_writes | 0 | +| Locked_connects | 0 | +| Max_execution_time_exceeded | 0 | +| Max_execution_time_set | 0 | +| Max_execution_time_set_failed | 0 | +| Max_used_connections | 2 | +| Max_used_connections_time | 2022-08-18 12:51:46 | +| Mysqlx_aborted_clients | 0 | +| Mysqlx_address | :: | +| Mysqlx_bytes_received | 0 | +| Mysqlx_bytes_received_compressed_payload | 0 | +| Mysqlx_bytes_received_uncompressed_frame | 0 | +| Mysqlx_bytes_sent | 0 | +| Mysqlx_bytes_sent_compressed_payload | 0 | +| Mysqlx_bytes_sent_uncompressed_frame | 0 | +| Mysqlx_compression_algorithm | | +| Mysqlx_compression_level | | +| Mysqlx_connection_accept_errors | 0 | +| Mysqlx_connection_errors | 0 | +| Mysqlx_connections_accepted | 0 | +| Mysqlx_connections_closed | 0 | +| Mysqlx_connections_rejected | 0 | +| Mysqlx_crud_create_view | 0 | +| Mysqlx_crud_delete | 0 | +| Mysqlx_crud_drop_view | 0 | +| Mysqlx_crud_find | 0 | +| Mysqlx_crud_insert | 0 | +| Mysqlx_crud_modify_view | 0 | +| Mysqlx_crud_update | 0 | +| Mysqlx_cursor_close | 0 | +| Mysqlx_cursor_fetch | 0 | +| Mysqlx_cursor_open | 0 | +| Mysqlx_errors_sent | 0 | +| Mysqlx_errors_unknown_message_type | 0 | +| Mysqlx_expect_close | 0 | +| Mysqlx_expect_open | 0 | +| Mysqlx_init_error | 0 | +| Mysqlx_messages_sent | 0 | +| Mysqlx_notice_global_sent | 0 | +| Mysqlx_notice_other_sent | 0 | +| Mysqlx_notice_warning_sent | 0 | +| Mysqlx_notified_by_group_replication | 0 | +| Mysqlx_port | 33060 | +| Mysqlx_prep_deallocate | 0 | +| Mysqlx_prep_execute | 0 | +| Mysqlx_prep_prepare | 0 | +| Mysqlx_rows_sent | 0 | +| Mysqlx_sessions | 0 | +| Mysqlx_sessions_accepted | 0 | +| Mysqlx_sessions_closed | 0 | +| Mysqlx_sessions_fatal_error | 0 | +| Mysqlx_sessions_killed | 0 | +| Mysqlx_sessions_rejected | 0 | +| Mysqlx_socket | /var/run/mysqld/mysqlx.sock | +| Mysqlx_ssl_accepts | 0 | +| Mysqlx_ssl_active | | +| Mysqlx_ssl_cipher | | +| Mysqlx_ssl_cipher_list | | +| Mysqlx_ssl_ctx_verify_depth | 18446744073709551615 | +| Mysqlx_ssl_ctx_verify_mode | 5 | +| Mysqlx_ssl_finished_accepts | 0 | +| Mysqlx_ssl_server_not_after | Aug 15 12:43:39 2032 GMT | +| Mysqlx_ssl_server_not_before | Aug 18 12:43:39 2022 GMT | +| Mysqlx_ssl_verify_depth | | +| Mysqlx_ssl_verify_mode | | +| Mysqlx_ssl_version | | +| Mysqlx_stmt_create_collection | 0 | +| Mysqlx_stmt_create_collection_index | 0 | +| Mysqlx_stmt_disable_notices | 0 | +| Mysqlx_stmt_drop_collection | 0 | +| Mysqlx_stmt_drop_collection_index | 0 | +| Mysqlx_stmt_enable_notices | 0 | +| Mysqlx_stmt_ensure_collection | 0 | +| Mysqlx_stmt_execute_mysqlx | 0 | +| Mysqlx_stmt_execute_sql | 0 | +| Mysqlx_stmt_execute_xplugin | 0 | +| Mysqlx_stmt_get_collection_options | 0 | +| Mysqlx_stmt_kill_client | 0 | +| Mysqlx_stmt_list_clients | 0 | +| Mysqlx_stmt_list_notices | 0 | +| Mysqlx_stmt_list_objects | 0 | +| Mysqlx_stmt_modify_collection_options | 0 | +| Mysqlx_stmt_ping | 0 | +| Mysqlx_worker_threads | 2 | +| Mysqlx_worker_threads_active | 0 | +| Not_flushed_delayed_rows | 0 | +| Ongoing_anonymous_transaction_count | 0 | +| Open_files | 8 | +| Open_streams | 0 | +| Open_table_definitions | 48 | +| Open_tables | 127 | +| Opened_files | 8 | +| Opened_table_definitions | 77 | +| Opened_tables | 208 | +| Performance_schema_accounts_lost | 0 | +| Performance_schema_cond_classes_lost | 0 | +| Performance_schema_cond_instances_lost | 0 | +| Performance_schema_digest_lost | 0 | +| Performance_schema_file_classes_lost | 0 | +| Performance_schema_file_handles_lost | 0 | +| Performance_schema_file_instances_lost | 0 | +| Performance_schema_hosts_lost | 0 | +| Performance_schema_index_stat_lost | 0 | +| Performance_schema_locker_lost | 0 | +| Performance_schema_memory_classes_lost | 0 | +| Performance_schema_metadata_lock_lost | 0 | +| Performance_schema_mutex_classes_lost | 0 | +| Performance_schema_mutex_instances_lost | 0 | +| Performance_schema_nested_statement_lost | 0 | +| Performance_schema_prepared_statements_lost | 0 | +| Performance_schema_program_lost | 0 | +| Performance_schema_rwlock_classes_lost | 0 | +| Performance_schema_rwlock_instances_lost | 0 | +| Performance_schema_session_connect_attrs_longest_seen | 112 | +| Performance_schema_session_connect_attrs_lost | 0 | +| Performance_schema_socket_classes_lost | 0 | +| Performance_schema_socket_instances_lost | 0 | +| Performance_schema_stage_classes_lost | 0 | +| Performance_schema_statement_classes_lost | 0 | +| Performance_schema_table_handles_lost | 0 | +| Performance_schema_table_instances_lost | 0 | +| Performance_schema_table_lock_stat_lost | 0 | +| Performance_schema_thread_classes_lost | 0 | +| Performance_schema_thread_instances_lost | 0 | +| Performance_schema_users_lost | 0 | +| Prepared_stmt_count | 0 | +| Queries | 27 | +| Questions | 15 | +| Replica_open_temp_tables | 0 | +| Secondary_engine_execution_count | 0 | +| Select_full_join | 0 | +| Select_full_range_join | 0 | +| Select_range | 0 | +| Select_range_check | 0 | +| Select_scan | 12 | +| Slave_open_temp_tables | 0 | +| Slow_launch_threads | 0 | +| Slow_queries | 0 | +| Sort_merge_passes | 0 | +| Sort_range | 0 | +| Sort_rows | 0 | +| Sort_scan | 0 | +| Ssl_accept_renegotiates | 0 | +| Ssl_accepts | 0 | +| Ssl_callback_cache_hits | 0 | +| Ssl_cipher | | +| Ssl_cipher_list | | +| Ssl_client_connects | 0 | +| Ssl_connect_renegotiates | 0 | +| Ssl_ctx_verify_depth | 18446744073709551615 | +| Ssl_ctx_verify_mode | 5 | +| Ssl_default_timeout | 0 | +| Ssl_finished_accepts | 0 | +| Ssl_finished_connects | 0 | +| Ssl_server_not_after | Aug 15 12:43:39 2032 GMT | +| Ssl_server_not_before | Aug 18 12:43:39 2022 GMT | +| Ssl_session_cache_hits | 0 | +| Ssl_session_cache_misses | 0 | +| Ssl_session_cache_mode | SERVER | +| Ssl_session_cache_overflows | 0 | +| Ssl_session_cache_size | 128 | +| Ssl_session_cache_timeout | 300 | +| Ssl_session_cache_timeouts | 0 | +| Ssl_sessions_reused | 0 | +| Ssl_used_session_cache_entries | 0 | +| Ssl_verify_depth | 0 | +| Ssl_verify_mode | 0 | +| Ssl_version | | +| Table_locks_immediate | 6 | +| Table_locks_waited | 0 | +| Table_open_cache_hits | 3182 | +| Table_open_cache_misses | 208 | +| Table_open_cache_overflows | 0 | +| Tc_log_max_pages_used | 0 | +| Tc_log_page_size | 0 | +| Tc_log_page_waits | 0 | +| Threads_cached | 1 | +| Threads_connected | 1 | +| Threads_created | 2 | +| Threads_running | 2 | +| Tls_library_version | OpenSSL 1.1.1k FIPS 25 Mar 2021 | +| Uptime | 152 | +| Uptime_since_flush_status | 152 | ++-------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/global_variables.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/global_variables.txt new file mode 100644 index 000000000..02be0ae8e --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/global_variables.txt @@ -0,0 +1,9 @@ ++--------------------------+-------+ +| Variable_name | Value | ++--------------------------+-------+ +| disabled_storage_engines | | +| log_bin | ON | +| max_connections | 151 | +| performance_schema | ON | +| table_open_cache | 4000 | ++--------------------------+-------+ diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/process_list.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/process_list.txt new file mode 100644 index 000000000..a44ce5e70 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/process_list.txt @@ -0,0 +1,6 @@ ++------+---------+ +| time | user | ++------+---------+ +| 1 | netdata | +| 9 | root | ++------+---------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/replica_status_multi_source.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/replica_status_multi_source.txt new file mode 100644 index 000000000..8a5e06836 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/replica_status_multi_source.txt @@ -0,0 +1,6 @@ ++----------------------------------+---------------+-------------+-------------+---------------+--------------------+---------------------+--------------------------------------+---------------+-----------------------+--------------------+---------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+-------------------------+-----------+---------------------+----------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+------------------------------------------+-----------------------------------------------------------------------------------+---------------+----------------------+--------------+--------------------+------------------------+-----------------------+-------------------+ +| Replica_IO_State | Source_Host | Source_User | Source_Port | Connect_Retry | Source_Log_File | Read_Source_Log_Pos | Relay_Log_File | Relay_Log_Pos | Relay_Source_Log_File | Replica_IO_Running | Replica_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error | Skip_Counter | Exec_Source_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Source_SSL_Allowed | Source_SSL_CA_File | Source_SSL_CA_Path | Source_SSL_Cert | Source_SSL_Cipher | Source_SSL_Key | Seconds_Behind_Source | Source_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Error | Last_SQL_Errno | Last_SQL_Error | Replicate_Ignore_Server_Ids | Source_Server_Id | Master_UUID | Source_Info_File | SQL_Delay | SQL_Remaining_Delay | Replica_SQL_Running_State | Source_Retry_Count | Source_Bind | Last_IO_Error_Timestamp | Last_SQL_Error_Timestamp | Source_SSL_Crl | Source_SSL_Crlpath | Retrieved_Gtid_Set | Executed_Gtid_Set | Auto_Position | Replicate_Rewrite_DB | Channel_Name | Source_TLS_Version | Source_public_key_path | Get_Source_public_key | Network_Namespace | ++----------------------------------+---------------+-------------+-------------+---------------+--------------------+---------------------+--------------------------------------+---------------+-----------------------+--------------------+---------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+-------------------------+-----------+---------------------+----------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+------------------------------------------+-----------------------------------------------------------------------------------+---------------+----------------------+--------------+--------------------+------------------------+-----------------------+-------------------+ +| Waiting for source to send event | mysql-master1 | repl1 | 3306 | 60 | mysql-bin-1.000003 | 975 | mysql-slave-relay-bin-master1.000003 | 1195 | mysql-bin-1.000003 | Yes | Yes | | | | | | | 0 | | 0 | 975 | 1599 | None | | 0 | No | | | | | | 0 | No | 0 | | 0 | | | 1 | 61221e31-1ef3-11ed-a56a-0242ac120002 | mysql.slave_master_info | 0 | NULL | Replica has read all relay log; waiting for more updates | 86400 | | | | | | 61221e31-1ef3-11ed-a56a-0242ac120002:1-3 | 61221e31-1ef3-11ed-a56a-0242ac120002:1-3,6151d979-1ef3-11ed-a509-0242ac120003:1-3 | 1 | | master1 | | | 0 | | +| Waiting for source to send event | mysql-master2 | repl2 | 3306 | 60 | mysql-bin-1.000003 | 974 | mysql-slave-relay-bin-master2.000003 | 1194 | mysql-bin-1.000003 | Yes | Yes | | | | | | | 0 | | 0 | 974 | 1598 | None | | 0 | No | | | | | | 0 | No | 0 | | 0 | | | 2 | 6151d979-1ef3-11ed-a509-0242ac120003 | mysql.slave_master_info | 0 | NULL | Replica has read all relay log; waiting for more updates | 86400 | | | | | | 6151d979-1ef3-11ed-a509-0242ac120003:1-3 | 61221e31-1ef3-11ed-a56a-0242ac120002:1-3,6151d979-1ef3-11ed-a509-0242ac120003:1-3 | 1 | | master2 | | | 0 | | ++----------------------------------+---------------+-------------+-------------+---------------+--------------------+---------------------+--------------------------------------+---------------+-----------------------+--------------------+---------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+-------------------------+-----------+---------------------+----------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+------------------------------------------+-----------------------------------------------------------------------------------+---------------+----------------------+--------------+--------------------+------------------------+-----------------------+-------------------+ diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/version.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/version.txt new file mode 100644 index 000000000..5c553b1ad --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/mysql/v8.0.30/version.txt @@ -0,0 +1,6 @@ ++-----------------+------------------------------+ +| Variable_name | Value | ++-----------------+------------------------------+ +| version | 8.0.30 | +| version_comment | MySQL Community Server - GPL | ++-----------------+------------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/global_status.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/global_status.txt new file mode 100644 index 000000000..d7ee5741a --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/global_status.txt @@ -0,0 +1,533 @@ ++--------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Variable_name | Value | ++--------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Aborted_clients | 0 | +| Aborted_connects | 1 | +| Acl_cache_items_count | 0 | +| Binlog_snapshot_file | | +| Binlog_snapshot_position | 0 | +| Binlog_cache_disk_use | 0 | +| Binlog_cache_use | 0 | +| Binlog_snapshot_gtid_executed | not-in-consistent-snapshot | +| Binlog_stmt_cache_disk_use | 0 | +| Binlog_stmt_cache_use | 0 | +| Bytes_received | 682970 | +| Bytes_sent | 33668405 | +| Com_admin_commands | 1 | +| Com_assign_to_keycache | 0 | +| Com_alter_db | 0 | +| Com_alter_event | 0 | +| Com_alter_function | 0 | +| Com_alter_instance | 0 | +| Com_alter_procedure | 0 | +| Com_alter_resource_group | 0 | +| Com_alter_server | 0 | +| Com_alter_table | 0 | +| Com_alter_tablespace | 0 | +| Com_alter_user | 0 | +| Com_alter_user_default_role | 0 | +| Com_analyze | 0 | +| Com_begin | 0 | +| Com_binlog | 0 | +| Com_call_procedure | 0 | +| Com_change_db | 1 | +| Com_change_master | 0 | +| Com_change_repl_filter | 0 | +| Com_change_replication_source | 0 | +| Com_check | 0 | +| Com_checksum | 0 | +| Com_clone | 0 | +| Com_commit | 0 | +| Com_create_compression_dictionary | 0 | +| Com_create_db | 1 | +| Com_create_event | 0 | +| Com_create_function | 0 | +| Com_create_index | 0 | +| Com_create_procedure | 0 | +| Com_create_role | 0 | +| Com_create_server | 0 | +| Com_create_table | 34 | +| Com_create_resource_group | 0 | +| Com_create_trigger | 0 | +| Com_create_udf | 0 | +| Com_create_user | 0 | +| Com_create_view | 0 | +| Com_create_spatial_reference_system | 0 | +| Com_dealloc_sql | 0 | +| Com_delete | 0 | +| Com_delete_multi | 0 | +| Com_do | 0 | +| Com_drop_compression_dictionary | 0 | +| Com_drop_db | 0 | +| Com_drop_event | 0 | +| Com_drop_function | 0 | +| Com_drop_index | 0 | +| Com_drop_procedure | 0 | +| Com_drop_resource_group | 0 | +| Com_drop_role | 0 | +| Com_drop_server | 0 | +| Com_drop_spatial_reference_system | 0 | +| Com_drop_table | 0 | +| Com_drop_trigger | 0 | +| Com_drop_user | 0 | +| Com_drop_view | 0 | +| Com_empty_query | 0 | +| Com_execute_sql | 0 | +| Com_explain_other | 0 | +| Com_flush | 1 | +| Com_get_diagnostics | 0 | +| Com_grant | 0 | +| Com_grant_roles | 0 | +| Com_ha_close | 0 | +| Com_ha_open | 0 | +| Com_ha_read | 0 | +| Com_help | 0 | +| Com_import | 0 | +| Com_insert | 0 | +| Com_insert_select | 0 | +| Com_install_component | 0 | +| Com_install_plugin | 0 | +| Com_kill | 0 | +| Com_load | 0 | +| Com_lock_instance | 0 | +| Com_lock_tables | 0 | +| Com_lock_tables_for_backup | 0 | +| Com_optimize | 0 | +| Com_preload_keys | 0 | +| Com_prepare_sql | 0 | +| Com_purge | 0 | +| Com_purge_before_date | 0 | +| Com_release_savepoint | 0 | +| Com_rename_table | 0 | +| Com_rename_user | 0 | +| Com_repair | 0 | +| Com_replace | 0 | +| Com_replace_select | 0 | +| Com_reset | 0 | +| Com_resignal | 0 | +| Com_restart | 0 | +| Com_revoke | 0 | +| Com_revoke_all | 0 | +| Com_revoke_roles | 0 | +| Com_rollback | 0 | +| Com_rollback_to_savepoint | 0 | +| Com_savepoint | 0 | +| Com_select | 1687 | +| Com_set_option | 4 | +| Com_set_password | 0 | +| Com_set_resource_group | 0 | +| Com_set_role | 0 | +| Com_signal | 0 | +| Com_show_binlog_events | 0 | +| Com_show_binlogs | 0 | +| Com_show_charsets | 0 | +| Com_show_client_statistics | 0 | +| Com_show_collations | 0 | +| Com_show_create_db | 0 | +| Com_show_create_event | 0 | +| Com_show_create_func | 0 | +| Com_show_create_proc | 0 | +| Com_show_create_table | 0 | +| Com_show_create_trigger | 0 | +| Com_show_databases | 0 | +| Com_show_engine_logs | 0 | +| Com_show_engine_mutex | 0 | +| Com_show_engine_status | 0 | +| Com_show_events | 0 | +| Com_show_errors | 0 | +| Com_show_fields | 0 | +| Com_show_function_code | 0 | +| Com_show_function_status | 0 | +| Com_show_grants | 0 | +| Com_show_index_statistics | 0 | +| Com_show_keys | 0 | +| Com_show_master_status | 0 | +| Com_show_open_tables | 0 | +| Com_show_plugins | 2 | +| Com_show_privileges | 0 | +| Com_show_procedure_code | 0 | +| Com_show_procedure_status | 0 | +| Com_show_processlist | 0 | +| Com_show_profile | 0 | +| Com_show_profiles | 0 | +| Com_show_relaylog_events | 0 | +| Com_show_replicas | 0 | +| Com_show_slave_hosts | 0 | +| Com_show_replica_status | 1681 | +| Com_show_slave_status | 1681 | +| Com_show_status | 1682 | +| Com_show_storage_engines | 0 | +| Com_show_table_statistics | 0 | +| Com_show_table_status | 0 | +| Com_show_tables | 0 | +| Com_show_thread_statistics | 0 | +| Com_show_triggers | 0 | +| Com_show_user_statistics | 0 | +| Com_show_variables | 1689 | +| Com_show_warnings | 0 | +| Com_show_create_user | 0 | +| Com_shutdown | 0 | +| Com_replica_start | 0 | +| Com_slave_start | 0 | +| Com_replica_stop | 0 | +| Com_slave_stop | 0 | +| Com_group_replication_start | 0 | +| Com_group_replication_stop | 0 | +| Com_stmt_execute | 0 | +| Com_stmt_close | 0 | +| Com_stmt_fetch | 0 | +| Com_stmt_prepare | 0 | +| Com_stmt_reset | 0 | +| Com_stmt_send_long_data | 0 | +| Com_truncate | 0 | +| Com_uninstall_component | 0 | +| Com_uninstall_plugin | 0 | +| Com_unlock_instance | 0 | +| Com_unlock_tables | 0 | +| Com_update | 0 | +| Com_update_multi | 0 | +| Com_xa_commit | 0 | +| Com_xa_end | 0 | +| Com_xa_prepare | 0 | +| Com_xa_recover | 0 | +| Com_xa_rollback | 0 | +| Com_xa_start | 0 | +| Com_stmt_reprepare | 0 | +| Connection_errors_accept | 0 | +| Connection_errors_internal | 0 | +| Connection_errors_max_connections | 0 | +| Connection_errors_peer_address | 0 | +| Connection_errors_select | 0 | +| Connection_errors_tcpwrap | 0 | +| Connections | 13 | +| Created_tmp_disk_tables | 1683 | +| Created_tmp_files | 5 | +| Created_tmp_tables | 5054 | +| Current_tls_ca | ca.pem | +| Current_tls_capath | | +| Current_tls_cert | server-cert.pem | +| Current_tls_cipher | | +| Current_tls_ciphersuites | | +| Current_tls_crl | | +| Current_tls_crlpath | | +| Current_tls_key | server-key.pem | +| Current_tls_version | TLSv1.2,TLSv1.3 | +| Delayed_errors | 0 | +| Delayed_insert_threads | 0 | +| Delayed_writes | 0 | +| Error_log_buffered_bytes | 1304 | +| Error_log_buffered_events | 9 | +| Error_log_expired_events | 0 | +| Error_log_latest_write | 1660920303043759 | +| Flush_commands | 3 | +| Global_connection_memory | 0 | +| Handler_commit | 576 | +| Handler_delete | 0 | +| Handler_discover | 0 | +| Handler_external_lock | 13215 | +| Handler_mrr_init | 0 | +| Handler_prepare | 0 | +| Handler_read_first | 1724 | +| Handler_read_key | 3439 | +| Handler_read_last | 0 | +| Handler_read_next | 4147 | +| Handler_read_prev | 0 | +| Handler_read_rnd | 0 | +| Handler_read_rnd_next | 2983285 | +| Handler_rollback | 0 | +| Handler_savepoint | 0 | +| Handler_savepoint_rollback | 0 | +| Handler_update | 317 | +| Handler_write | 906501 | +| Innodb_background_log_sync | 0 | +| Innodb_buffer_pool_dump_status | Dumping of buffer pool not started | +| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 220819 14:45:02 | +| Innodb_buffer_pool_resize_status | | +| Innodb_buffer_pool_pages_data | 1123 | +| Innodb_buffer_pool_bytes_data | 18399232 | +| Innodb_buffer_pool_pages_dirty | 3 | +| Innodb_buffer_pool_bytes_dirty | 49152 | +| Innodb_buffer_pool_pages_flushed | 205 | +| Innodb_buffer_pool_pages_free | 7064 | +| Innodb_buffer_pool_pages_LRU_flushed | 0 | +| Innodb_buffer_pool_pages_made_not_young | 27 | +| Innodb_buffer_pool_pages_made_young | 6342 | +| Innodb_buffer_pool_pages_misc | 5 | +| Innodb_buffer_pool_pages_old | 421 | +| Innodb_buffer_pool_pages_total | 8192 | +| Innodb_buffer_pool_read_ahead_rnd | 0 | +| Innodb_buffer_pool_read_ahead | 0 | +| Innodb_buffer_pool_read_ahead_evicted | 0 | +| Innodb_buffer_pool_read_requests | 109817 | +| Innodb_buffer_pool_reads | 978 | +| Innodb_buffer_pool_wait_free | 0 | +| Innodb_buffer_pool_write_requests | 77412 | +| Innodb_checkpoint_age | 0 | +| Innodb_checkpoint_max_age | 80576000 | +| Innodb_data_fsyncs | 50 | +| Innodb_data_pending_fsyncs | 0 | +| Innodb_data_pending_reads | 0 | +| Innodb_data_pending_writes | 0 | +| Innodb_data_read | 16094208 | +| Innodb_data_reads | 1002 | +| Innodb_data_writes | 288 | +| Innodb_data_written | 3420160 | +| Innodb_dblwr_pages_written | 30 | +| Innodb_dblwr_writes | 8 | +| Innodb_ibuf_free_list | 0 | +| Innodb_ibuf_segment_size | 2 | +| Innodb_log_waits | 0 | +| Innodb_log_write_requests | 651 | +| Innodb_log_writes | 47 | +| Innodb_lsn_current | 31778525 | +| Innodb_lsn_flushed | 31778525 | +| Innodb_lsn_last_checkpoint | 31778525 | +| Innodb_master_thread_active_loops | 1674 | +| Innodb_master_thread_idle_loops | 36 | +| Innodb_max_trx_id | 1803 | +| Innodb_oldest_view_low_limit_trx_id | 0 | +| Innodb_os_log_fsyncs | 13 | +| Innodb_os_log_pending_fsyncs | 0 | +| Innodb_os_log_pending_writes | 0 | +| Innodb_os_log_written | 45568 | +| Innodb_page_size | 16384 | +| Innodb_pages_created | 155 | +| Innodb_pages_read | 977 | +| Innodb_pages0_read | 7 | +| Innodb_pages_written | 205 | +| Innodb_purge_trx_id | 1801 | +| Innodb_purge_undo_no | 0 | +| Innodb_redo_log_enabled | ON | +| Innodb_row_lock_current_waits | 0 | +| Innodb_row_lock_time | 0 | +| Innodb_row_lock_time_avg | 0 | +| Innodb_row_lock_time_max | 0 | +| Innodb_row_lock_waits | 0 | +| Innodb_rows_deleted | 0 | +| Innodb_rows_inserted | 5055 | +| Innodb_rows_read | 5055 | +| Innodb_rows_updated | 0 | +| Innodb_system_rows_deleted | 0 | +| Innodb_system_rows_inserted | 0 | +| Innodb_system_rows_read | 4881 | +| Innodb_system_rows_updated | 317 | +| Innodb_sampled_pages_read | 0 | +| Innodb_sampled_pages_skipped | 0 | +| Innodb_num_open_files | 17 | +| Innodb_truncated_status_writes | 0 | +| Innodb_undo_tablespaces_total | 2 | +| Innodb_undo_tablespaces_implicit | 2 | +| Innodb_undo_tablespaces_explicit | 0 | +| Innodb_undo_tablespaces_active | 2 | +| Innodb_secondary_index_triggered_cluster_reads | 2098 | +| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 | +| Innodb_buffered_aio_submitted | 0 | +| Innodb_scan_pages_contiguous | 0 | +| Innodb_scan_pages_disjointed | 0 | +| Innodb_scan_pages_total_seek_distance | 0 | +| Innodb_scan_data_size | 0 | +| Innodb_scan_deleted_recs_size | 0 | +| Innodb_scrub_log | 0 | +| Innodb_scrub_background_page_reorganizations | 0 | +| Innodb_scrub_background_page_splits | 0 | +| Innodb_scrub_background_page_split_failures_underflow | 0 | +| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 | +| Innodb_scrub_background_page_split_failures_missing_index | 0 | +| Innodb_scrub_background_page_split_failures_unknown | 0 | +| Innodb_encryption_n_merge_blocks_encrypted | 0 | +| Innodb_encryption_n_merge_blocks_decrypted | 0 | +| Innodb_encryption_n_rowlog_blocks_encrypted | 0 | +| Innodb_encryption_n_rowlog_blocks_decrypted | 0 | +| Innodb_encryption_redo_key_version | 0 | +| Key_blocks_not_flushed | 0 | +| Key_blocks_unused | 6698 | +| Key_blocks_used | 0 | +| Key_read_requests | 0 | +| Key_reads | 0 | +| Key_write_requests | 0 | +| Key_writes | 0 | +| Locked_connects | 0 | +| Max_execution_time_exceeded | 0 | +| Max_execution_time_set | 0 | +| Max_execution_time_set_failed | 0 | +| Max_used_connections | 3 | +| Max_used_connections_time | 2022-08-19 15:05:34 | +| Mysqlx_aborted_clients | 0 | +| Mysqlx_address | :: | +| Mysqlx_bytes_received | 0 | +| Mysqlx_bytes_received_compressed_payload | 0 | +| Mysqlx_bytes_received_uncompressed_frame | 0 | +| Mysqlx_bytes_sent | 0 | +| Mysqlx_bytes_sent_compressed_payload | 0 | +| Mysqlx_bytes_sent_uncompressed_frame | 0 | +| Mysqlx_compression_algorithm | | +| Mysqlx_compression_level | | +| Mysqlx_connection_accept_errors | 0 | +| Mysqlx_connection_errors | 0 | +| Mysqlx_connections_accepted | 0 | +| Mysqlx_connections_closed | 0 | +| Mysqlx_connections_rejected | 0 | +| Mysqlx_crud_create_view | 0 | +| Mysqlx_crud_delete | 0 | +| Mysqlx_crud_drop_view | 0 | +| Mysqlx_crud_find | 0 | +| Mysqlx_crud_insert | 0 | +| Mysqlx_crud_modify_view | 0 | +| Mysqlx_crud_update | 0 | +| Mysqlx_cursor_close | 0 | +| Mysqlx_cursor_fetch | 0 | +| Mysqlx_cursor_open | 0 | +| Mysqlx_errors_sent | 0 | +| Mysqlx_errors_unknown_message_type | 0 | +| Mysqlx_expect_close | 0 | +| Mysqlx_expect_open | 0 | +| Mysqlx_init_error | 0 | +| Mysqlx_messages_sent | 0 | +| Mysqlx_notice_global_sent | 0 | +| Mysqlx_notice_other_sent | 0 | +| Mysqlx_notice_warning_sent | 0 | +| Mysqlx_notified_by_group_replication | 0 | +| Mysqlx_port | 33060 | +| Mysqlx_prep_deallocate | 0 | +| Mysqlx_prep_execute | 0 | +| Mysqlx_prep_prepare | 0 | +| Mysqlx_rows_sent | 0 | +| Mysqlx_sessions | 0 | +| Mysqlx_sessions_accepted | 0 | +| Mysqlx_sessions_closed | 0 | +| Mysqlx_sessions_fatal_error | 0 | +| Mysqlx_sessions_killed | 0 | +| Mysqlx_sessions_rejected | 0 | +| Mysqlx_socket | /var/lib/mysql/mysqlx.sock | +| Mysqlx_ssl_accepts | 0 | +| Mysqlx_ssl_active | | +| Mysqlx_ssl_cipher | | +| Mysqlx_ssl_cipher_list | | +| Mysqlx_ssl_ctx_verify_depth | 18446744073709551615 | +| Mysqlx_ssl_ctx_verify_mode | 5 | +| Mysqlx_ssl_finished_accepts | 0 | +| Mysqlx_ssl_server_not_after | Aug 16 14:44:56 2032 GMT | +| Mysqlx_ssl_server_not_before | Aug 19 14:44:56 2022 GMT | +| Mysqlx_ssl_verify_depth | | +| Mysqlx_ssl_verify_mode | | +| Mysqlx_ssl_version | | +| Mysqlx_stmt_create_collection | 0 | +| Mysqlx_stmt_create_collection_index | 0 | +| Mysqlx_stmt_disable_notices | 0 | +| Mysqlx_stmt_drop_collection | 0 | +| Mysqlx_stmt_drop_collection_index | 0 | +| Mysqlx_stmt_enable_notices | 0 | +| Mysqlx_stmt_ensure_collection | 0 | +| Mysqlx_stmt_execute_mysqlx | 0 | +| Mysqlx_stmt_execute_sql | 0 | +| Mysqlx_stmt_execute_xplugin | 0 | +| Mysqlx_stmt_get_collection_options | 0 | +| Mysqlx_stmt_kill_client | 0 | +| Mysqlx_stmt_list_clients | 0 | +| Mysqlx_stmt_list_notices | 0 | +| Mysqlx_stmt_list_objects | 0 | +| Mysqlx_stmt_modify_collection_options | 0 | +| Mysqlx_stmt_ping | 0 | +| Mysqlx_worker_threads | 2 | +| Mysqlx_worker_threads_active | 0 | +| Net_buffer_length | 32768 | +| Not_flushed_delayed_rows | 0 | +| Ongoing_anonymous_transaction_count | 0 | +| Open_files | 2 | +| Open_streams | 0 | +| Open_table_definitions | 44 | +| Open_tables | 77 | +| Opened_files | 2 | +| Opened_table_definitions | 73 | +| Opened_tables | 158 | +| Performance_schema_accounts_lost | 0 | +| Performance_schema_cond_classes_lost | 0 | +| Performance_schema_cond_instances_lost | 0 | +| Performance_schema_digest_lost | 0 | +| Performance_schema_file_classes_lost | 0 | +| Performance_schema_file_handles_lost | 0 | +| Performance_schema_file_instances_lost | 0 | +| Performance_schema_hosts_lost | 0 | +| Performance_schema_index_stat_lost | 0 | +| Performance_schema_locker_lost | 0 | +| Performance_schema_memory_classes_lost | 0 | +| Performance_schema_metadata_lock_lost | 0 | +| Performance_schema_mutex_classes_lost | 0 | +| Performance_schema_mutex_instances_lost | 0 | +| Performance_schema_nested_statement_lost | 0 | +| Performance_schema_prepared_statements_lost | 0 | +| Performance_schema_program_lost | 0 | +| Performance_schema_rwlock_classes_lost | 0 | +| Performance_schema_rwlock_instances_lost | 0 | +| Performance_schema_session_connect_attrs_longest_seen | 117 | +| Performance_schema_session_connect_attrs_lost | 0 | +| Performance_schema_socket_classes_lost | 0 | +| Performance_schema_socket_instances_lost | 0 | +| Performance_schema_stage_classes_lost | 0 | +| Performance_schema_statement_classes_lost | 0 | +| Performance_schema_table_handles_lost | 0 | +| Performance_schema_table_instances_lost | 0 | +| Performance_schema_table_lock_stat_lost | 0 | +| Performance_schema_thread_classes_lost | 0 | +| Performance_schema_thread_instances_lost | 0 | +| Performance_schema_users_lost | 0 | +| Prepared_stmt_count | 0 | +| Queries | 6748 | +| Questions | 6746 | +| Replica_open_temp_tables | 0 | +| Secondary_engine_execution_count | 0 | +| Select_full_join | 0 | +| Select_full_range_join | 0 | +| Select_range | 0 | +| Select_range_check | 0 | +| Select_scan | 8425 | +| Slave_open_temp_tables | 0 | +| Slow_launch_threads | 0 | +| Slow_queries | 0 | +| Sort_merge_passes | 0 | +| Sort_range | 0 | +| Sort_rows | 0 | +| Sort_scan | 1681 | +| Ssl_accept_renegotiates | 0 | +| Ssl_accepts | 0 | +| Ssl_callback_cache_hits | 0 | +| Ssl_cipher | | +| Ssl_cipher_list | | +| Ssl_client_connects | 0 | +| Ssl_connect_renegotiates | 0 | +| Ssl_ctx_verify_depth | 18446744073709551615 | +| Ssl_ctx_verify_mode | 5 | +| Ssl_default_timeout | 0 | +| Ssl_finished_accepts | 0 | +| Ssl_finished_connects | 0 | +| Ssl_server_not_after | Aug 16 14:44:56 2032 GMT | +| Ssl_server_not_before | Aug 19 14:44:56 2022 GMT | +| Ssl_session_cache_hits | 0 | +| Ssl_session_cache_misses | 0 | +| Ssl_session_cache_mode | SERVER | +| Ssl_session_cache_overflows | 0 | +| Ssl_session_cache_size | 128 | +| Ssl_session_cache_timeout | 300 | +| Ssl_session_cache_timeouts | 0 | +| Ssl_sessions_reused | 0 | +| Ssl_used_session_cache_entries | 0 | +| Ssl_verify_depth | 0 | +| Ssl_verify_mode | 0 | +| Ssl_version | | +| Table_locks_immediate | 3371 | +| Table_locks_waited | 0 | +| Table_open_cache_hits | 6450 | +| Table_open_cache_misses | 158 | +| Table_open_cache_overflows | 0 | +| Tc_log_max_pages_used | 0 | +| Tc_log_page_size | 0 | +| Tc_log_page_waits | 0 | +| Threadpool_idle_threads | 0 | +| Threadpool_threads | 0 | +| Threads_cached | 1 | +| Threads_connected | 2 | +| Threads_created | 3 | +| Threads_running | 2 | +| Uptime | 1711 | +| Uptime_since_flush_status | 1711 | ++--------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/global_variables.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/global_variables.txt new file mode 100644 index 000000000..02be0ae8e --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/global_variables.txt @@ -0,0 +1,9 @@ ++--------------------------+-------+ +| Variable_name | Value | ++--------------------------+-------+ +| disabled_storage_engines | | +| log_bin | ON | +| max_connections | 151 | +| performance_schema | ON | +| table_open_cache | 4000 | ++--------------------------+-------+ diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/process_list.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/process_list.txt new file mode 100644 index 000000000..a44ce5e70 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/process_list.txt @@ -0,0 +1,6 @@ ++------+---------+ +| time | user | ++------+---------+ +| 1 | netdata | +| 9 | root | ++------+---------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/user_statistics.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/user_statistics.txt new file mode 100644 index 000000000..d7c206e47 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/user_statistics.txt @@ -0,0 +1,6 @@ ++---------+-------------------+------------------------+--------------------+---------------------+---------------------+----------------+------------+----------------------+--------------+--------------+-----------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+ +| User | Total_connections | Concurrent_connections | Connected_time | Busy_time | Cpu_time | Bytes_received | Bytes_sent | Binlog_bytes_written | Rows_fetched | Rows_updated | Table_rows_read | Select_commands | Update_commands | Other_commands | Commit_transactions | Rollback_transactions | Denied_connections | Lost_connections | Access_denied | Empty_queries | Total_ssl_connections | ++---------+-------------------+------------------------+--------------------+---------------------+---------------------+----------------+------------+----------------------+--------------+--------------+-----------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+ +| netdata | 1 | 0 | 7.6873109 | 0.000136 | 0.000141228 | 71 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| root | 2 | 0 | 1843013485340.5564 | 0.15132199999999996 | 0.15179981700000006 | 14681 | 573440 | 0 | 1 | 0 | 114633 | 37 | 0 | 110 | 0 | 0 | 1 | 0 | 0 | 36 | 0 | ++---------+-------------------+------------------------+--------------------+---------------------+---------------------+----------------+------------+----------------------+--------------+--------------+-----------------+-----------------+-----------------+----------------+---------------------+-----------------------+--------------------+------------------+---------------+---------------+-----------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/version.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/version.txt new file mode 100644 index 000000000..dede361ef --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/percona/v8.0.29/version.txt @@ -0,0 +1,6 @@ ++-----------------+--------------------------------------------------------+ +| Variable_name | Value | ++-----------------+--------------------------------------------------------+ +| version | 8.0.29-21 | +| version_comment | Percona Server (GPL), Release 21, Revision c59f87d2854 | ++-----------------+--------------------------------------------------------+
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/mysql/testdata/session_variables.txt b/src/go/collectors/go.d.plugin/modules/mysql/testdata/session_variables.txt new file mode 100644 index 000000000..358750607 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/mysql/testdata/session_variables.txt @@ -0,0 +1,6 @@ ++----------------+-------+ +| Variable_name | Value | ++----------------+-------+ +| sql_log_off | OFF | +| slow_query_log | ON | ++----------------+-------+
\ No newline at end of file |