sensu-plugins-mysql 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f4e28c5fe85bbb08ea031b00e2f59ab2aa87659ab13d8956815cb30a327a659
4
- data.tar.gz: c597db8661b11a7cc1a4d57afcca1295d89e152bfdf53440ee13d503ec20c36f
3
+ metadata.gz: f050ecf7e999bf8ff96e3e089c875532184987ad802cfb1c3d41de64a2b65954
4
+ data.tar.gz: f6d603d1a7b63efedb0e936d9aa0a55d4e598cfc02fbffede44619552af44fbf
5
5
  SHA512:
6
- metadata.gz: d2724a9e0af371a833139e5fb60356612a9e2e9a9626459dfb3cf6afc3c0b3bd3bf70a5cf0cee0eff42494763ac033e5dda17f194acc3ab182a96f4ad64a8361
7
- data.tar.gz: 7c04bd29f0a1e41782dd90cea6744dd674951d42cb398e482af97975229c4bf37ffa5e9b109f8dabf2212e1b9a33e2c971b0721cac851204f1d8dba70c4305c9
6
+ metadata.gz: 84049e67a1c9181c8ad6f2e6df7fe9ac8cc4c947fae1b2c779dd6eae409155ea3bfec5a1565185b142dd5c548cf15de44d077f7c7f5897ff53ece963aca0daf0
7
+ data.tar.gz: 45f695cfe8b6400f12b21dcfe6709f9838db5c1dd71b2996e90021b8198a8ea95b23917cbad277aa2ed18b9583cc373d749c9a21c6806e1f6024adcf6b24243e
@@ -5,6 +5,14 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [3.2.0] - 2020-08-26
9
+ ### Changed
10
+ - Bump sensu-plugin dependency from ~> 1.2 to ~> 4.0
11
+ - Updated bundler dependancy to '~> 2.1'
12
+ - Updated rubocop dependency to '~> 0.81.0'
13
+ - Remediated rubocop issues
14
+ - Updated rake dependency to '~> 13.0'
15
+
8
16
  ## [3.1.1] - 2019-03-04
9
17
  ### Fixed
10
18
  - check-mysql-disk.rb: update defaults for float and integer values as a string as the defaults apparently do not execute the proc which would have properly converted it to the appropriate type (@majormoses)
@@ -160,7 +168,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
160
168
  ### Added
161
169
  - initial release
162
170
 
163
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mysql/compare/3.1.1...HEAD
171
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mysql/compare/3.2.0...HEAD
172
+ [3.2.0]: https://github.com/sensu-plugins/sensu-plugins-mysql/compare/3.1.1...3.2.0
164
173
  [3.1.1]: https://github.com/sensu-plugins/sensu-plugins-mysql/compare/3.1.0...3.1.1
165
174
  [3.1.0]: https://github.com/sensu-plugins/sensu-plugins-mysql/compare/3.0.0...3.1.0
166
175
  [3.0.0]: https://github.com/sensu-plugins/sensu-plugins-mysql/compare/2.7.0...3.0.0
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Alive Plugin
4
6
  # ===
@@ -96,7 +98,7 @@ class CheckMySQL < Sensu::Plugin::Check::CLI
96
98
  rescue Mysql::Error => e
97
99
  critical "Error message: #{e.error}"
98
100
  ensure
99
- db.close if db
101
+ db&.close
100
102
  end
101
103
  end
102
104
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Health Plugin
4
6
  # ===
@@ -105,6 +107,6 @@ class CheckMySQLHealth < Sensu::Plugin::Check::CLI
105
107
  rescue Mysql::Error => e
106
108
  critical "MySQL check failed: #{e.error}"
107
109
  ensure
108
- db.close if db
110
+ db&.close
109
111
  end
110
112
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Disk Usage Check
4
6
  # ===
@@ -108,11 +110,9 @@ class CheckMysqlDisk < Sensu::Plugin::Check::CLI
108
110
  FROM information_schema.TABLES group by table_schema
109
111
  SQL
110
112
 
111
- unless results.nil?
112
- results.each_hash do |row|
113
- # #YELLOW
114
- total_size = total_size + row['total_size'].to_f # rubocop:disable Style/SelfAssignment
115
- end
113
+ results&.each_hash do |row|
114
+ # #YELLOW
115
+ total_size = total_size + row['total_size'].to_f # rubocop:disable Style/SelfAssignment
116
116
  end
117
117
 
118
118
  disk_use_percentage = total_size / disk_size * 100
@@ -131,7 +131,7 @@ class CheckMysqlDisk < Sensu::Plugin::Check::CLI
131
131
  rescue StandardError => e
132
132
  critical e
133
133
  ensure
134
- db.close if db
134
+ db&.close
135
135
  end
136
136
  end
137
137
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL InnoDB Lock Check Plugin
4
6
  # ===
@@ -143,6 +145,6 @@ class CheckMySQLInnoDBLock < Sensu::Plugin::Check::CLI
143
145
  rescue Mysql::Error => e
144
146
  critical "MySQL check failed: #{e.error}"
145
147
  ensure
146
- db.close if db
148
+ db&.close
147
149
  end
148
150
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Multi-source Replication Status
4
6
  # ===
@@ -151,7 +153,7 @@ class CheckMysqlMSRReplicationStatus < Sensu::Plugin::Check::CLI
151
153
  rescue StandardError => e
152
154
  critical "unhandled exception: #{e}"
153
155
  ensure
154
- db.close if db
156
+ db&.close
155
157
  end
156
158
  end
157
159
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Query Result Count Check
4
6
  #
@@ -105,6 +107,6 @@ class MysqlQueryCountCheck < Sensu::Plugin::Check::CLI
105
107
  rescue StandardError => e
106
108
  critical e
107
109
  ensure
108
- db.close if db
110
+ db&.close
109
111
  end
110
112
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Replication Status (modded from disk)
4
6
  # ===
@@ -45,7 +47,7 @@ class CheckMysqlReplicationStatus < Sensu::Plugin::Check::CLI
45
47
  description: 'Database port',
46
48
  default: 3306,
47
49
  # #YELLOW
48
- proc: lambda { |s| s.to_i } # rubocop:disable Lambda
50
+ proc: lambda { |s| s.to_i } # rubocop:disable Style/Lambda
49
51
 
50
52
  option :socket,
51
53
  short: '-s SOCKET',
@@ -83,7 +85,7 @@ class CheckMysqlReplicationStatus < Sensu::Plugin::Check::CLI
83
85
  description: 'Warning threshold for replication lag',
84
86
  default: 900,
85
87
  # #YELLOW
86
- proc: lambda { |s| s.to_i } # rubocop:disable Lambda
88
+ proc: lambda { |s| s.to_i } # rubocop:disable Style/Lambda
87
89
 
88
90
  option :crit,
89
91
  short: '-c',
@@ -91,7 +93,7 @@ class CheckMysqlReplicationStatus < Sensu::Plugin::Check::CLI
91
93
  description: 'Critical threshold for replication lag',
92
94
  default: 1800,
93
95
  # #YELLOW
94
- proc: lambda { |s| s.to_i } # rubocop:disable Lambda
96
+ proc: lambda { |s| s.to_i } # rubocop:disable Style/Lambda
95
97
 
96
98
  def detect_replication_status?(row)
97
99
  %w[
@@ -179,7 +181,7 @@ class CheckMysqlReplicationStatus < Sensu::Plugin::Check::CLI
179
181
  rescue StandardError => e
180
182
  critical e
181
183
  ensure
182
- db.close if db
184
+ db&.close
183
185
  end
184
186
  end
185
187
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Select Count Check
4
6
  #
@@ -108,6 +110,6 @@ class MysqlSelectCountCheck < Sensu::Plugin::Check::CLI
108
110
  rescue StandardError => e
109
111
  critical "unhandled exception: #{e}"
110
112
  ensure
111
- db.close if db
113
+ db&.close
112
114
  end
113
115
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Status Plugin
4
6
  # ===
@@ -115,11 +117,13 @@ class CheckMySQLStatus < Sensu::Plugin::Check::CLI
115
117
  section = ini[config[:ini_section]]
116
118
  db_user = section['user']
117
119
  db_pass = section['password']
120
+ # rubocop:disable Style/RedundantCondition
118
121
  db_socket = if config[:socket]
119
122
  config[:socket]
120
123
  else
121
124
  section['socket']
122
125
  end
126
+ # rubocop:enable Style/RedundantCondition
123
127
  else
124
128
  db_user = config[:user]
125
129
  db_pass = config[:password]
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # check-mysql-threads.rb
4
6
  #
@@ -117,6 +119,6 @@ class CheckMySQLHealth < Sensu::Plugin::Check::CLI
117
119
  rescue Mysql::Error => e
118
120
  critical "MySQL check failed: #{e.error}"
119
121
  ensure
120
- db.close if db
122
+ db&.close
121
123
  end
122
124
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # Push mysql stats into graphite
4
6
  # ===
@@ -93,112 +95,112 @@ class MysqlGraphite < Sensu::Plugin::Metric::CLI::Graphite
93
95
  def metrics_hash
94
96
  {
95
97
  'general' => {
96
- 'Bytes_received' => 'rxBytes',
97
- 'Bytes_sent' => 'txBytes',
98
- 'Key_read_requests' => 'keyRead_requests',
99
- 'Key_reads' => 'keyReads',
100
- 'Key_write_requests' => 'keyWrite_requests',
101
- 'Key_writes' => 'keyWrites',
102
- 'Binlog_cache_use' => 'binlogCacheUse',
103
- 'Binlog_cache_disk_use' => 'binlogCacheDiskUse',
104
- 'Max_used_connections' => 'maxUsedConnections',
105
- 'Aborted_clients' => 'abortedClients',
106
- 'Aborted_connects' => 'abortedConnects',
107
- 'Threads_connected' => 'threadsConnected',
108
- 'Open_files' => 'openFiles',
109
- 'Open_tables' => 'openTables',
110
- 'Opened_tables' => 'openedTables',
111
- 'Prepared_stmt_count' => 'preparedStmtCount',
112
- 'Seconds_Behind_Master' => 'slaveLag',
113
- 'Select_full_join' => 'fullJoins',
98
+ 'Bytes_received' => 'rxBytes',
99
+ 'Bytes_sent' => 'txBytes',
100
+ 'Key_read_requests' => 'keyRead_requests',
101
+ 'Key_reads' => 'keyReads',
102
+ 'Key_write_requests' => 'keyWrite_requests',
103
+ 'Key_writes' => 'keyWrites',
104
+ 'Binlog_cache_use' => 'binlogCacheUse',
105
+ 'Binlog_cache_disk_use' => 'binlogCacheDiskUse',
106
+ 'Max_used_connections' => 'maxUsedConnections',
107
+ 'Aborted_clients' => 'abortedClients',
108
+ 'Aborted_connects' => 'abortedConnects',
109
+ 'Threads_connected' => 'threadsConnected',
110
+ 'Open_files' => 'openFiles',
111
+ 'Open_tables' => 'openTables',
112
+ 'Opened_tables' => 'openedTables',
113
+ 'Prepared_stmt_count' => 'preparedStmtCount',
114
+ 'Seconds_Behind_Master' => 'slaveLag',
115
+ 'Select_full_join' => 'fullJoins',
114
116
  'Select_full_range_join' => 'fullRangeJoins',
115
- 'Select_range' => 'selectRange',
116
- 'Select_range_check' => 'selectRange_check',
117
- 'Select_scan' => 'selectScan',
118
- 'Slow_queries' => 'slowQueries',
117
+ 'Select_range' => 'selectRange',
118
+ 'Select_range_check' => 'selectRange_check',
119
+ 'Select_scan' => 'selectScan',
120
+ 'Slow_queries' => 'slowQueries'
119
121
  },
120
122
  'querycache' => {
121
- 'Qcache_queries_in_cache' => 'queriesInCache',
122
- 'Qcache_hits' => 'cacheHits',
123
- 'Qcache_inserts' => 'inserts',
124
- 'Qcache_not_cached' => 'notCached',
125
- 'Qcache_lowmem_prunes' => 'lowMemPrunes',
123
+ 'Qcache_queries_in_cache' => 'queriesInCache',
124
+ 'Qcache_hits' => 'cacheHits',
125
+ 'Qcache_inserts' => 'inserts',
126
+ 'Qcache_not_cached' => 'notCached',
127
+ 'Qcache_lowmem_prunes' => 'lowMemPrunes'
126
128
  },
127
129
  'commands' => {
128
130
  'Com_admin_commands' => 'admin_commands',
129
- 'Com_begin' => 'begin',
130
- 'Com_change_db' => 'change_db',
131
- 'Com_commit' => 'commit',
132
- 'Com_create_table' => 'create_table',
133
- 'Com_drop_table' => 'drop_table',
134
- 'Com_show_keys' => 'show_keys',
135
- 'Com_delete' => 'delete',
136
- 'Com_create_db' => 'create_db',
137
- 'Com_grant' => 'grant',
131
+ 'Com_begin' => 'begin',
132
+ 'Com_change_db' => 'change_db',
133
+ 'Com_commit' => 'commit',
134
+ 'Com_create_table' => 'create_table',
135
+ 'Com_drop_table' => 'drop_table',
136
+ 'Com_show_keys' => 'show_keys',
137
+ 'Com_delete' => 'delete',
138
+ 'Com_create_db' => 'create_db',
139
+ 'Com_grant' => 'grant',
138
140
  'Com_show_processlist' => 'show_processlist',
139
- 'Com_flush' => 'flush',
140
- 'Com_insert' => 'insert',
141
- 'Com_purge' => 'purge',
142
- 'Com_replace' => 'replace',
143
- 'Com_rollback' => 'rollback',
144
- 'Com_select' => 'select',
145
- 'Com_set_option' => 'set_option',
146
- 'Com_show_binlogs' => 'show_binlogs',
141
+ 'Com_flush' => 'flush',
142
+ 'Com_insert' => 'insert',
143
+ 'Com_purge' => 'purge',
144
+ 'Com_replace' => 'replace',
145
+ 'Com_rollback' => 'rollback',
146
+ 'Com_select' => 'select',
147
+ 'Com_set_option' => 'set_option',
148
+ 'Com_show_binlogs' => 'show_binlogs',
147
149
  'Com_show_databases' => 'show_databases',
148
- 'Com_show_fields' => 'show_fields',
149
- 'Com_show_status' => 'show_status',
150
- 'Com_show_tables' => 'show_tables',
150
+ 'Com_show_fields' => 'show_fields',
151
+ 'Com_show_status' => 'show_status',
152
+ 'Com_show_tables' => 'show_tables',
151
153
  'Com_show_variables' => 'show_variables',
152
- 'Com_update' => 'update',
153
- 'Com_drop_db' => 'drop_db',
154
- 'Com_revoke' => 'revoke',
155
- 'Com_drop_user' => 'drop_user',
156
- 'Com_show_grants' => 'show_grants',
157
- 'Com_lock_tables' => 'lock_tables',
154
+ 'Com_update' => 'update',
155
+ 'Com_drop_db' => 'drop_db',
156
+ 'Com_revoke' => 'revoke',
157
+ 'Com_drop_user' => 'drop_user',
158
+ 'Com_show_grants' => 'show_grants',
159
+ 'Com_lock_tables' => 'lock_tables',
158
160
  'Com_show_create_table' => 'show_create_table',
159
- 'Com_unlock_tables' => 'unlock_tables',
160
- 'Com_alter_table' => 'alter_table',
161
+ 'Com_unlock_tables' => 'unlock_tables',
162
+ 'Com_alter_table' => 'alter_table'
161
163
  },
162
164
  'counters' => {
163
- 'Handler_write' => 'handlerWrite',
164
- 'Handler_update' => 'handlerUpdate',
165
- 'Handler_delete' => 'handlerDelete',
166
- 'Handler_read_first' => 'handlerRead_first',
167
- 'Handler_read_key' => 'handlerRead_key',
168
- 'Handler_read_next' => 'handlerRead_next',
169
- 'Handler_read_prev' => 'handlerRead_prev',
170
- 'Handler_read_rnd' => 'handlerRead_rnd',
171
- 'Handler_read_rnd_next' => 'handlerRead_rnd_next',
172
- 'Handler_commit' => 'handlerCommit',
173
- 'Handler_rollback' => 'handlerRollback',
174
- 'Handler_savepoint' => 'handlerSavepoint',
175
- 'Handler_savepoint_rollback' => 'handlerSavepointRollback',
165
+ 'Handler_write' => 'handlerWrite',
166
+ 'Handler_update' => 'handlerUpdate',
167
+ 'Handler_delete' => 'handlerDelete',
168
+ 'Handler_read_first' => 'handlerRead_first',
169
+ 'Handler_read_key' => 'handlerRead_key',
170
+ 'Handler_read_next' => 'handlerRead_next',
171
+ 'Handler_read_prev' => 'handlerRead_prev',
172
+ 'Handler_read_rnd' => 'handlerRead_rnd',
173
+ 'Handler_read_rnd_next' => 'handlerRead_rnd_next',
174
+ 'Handler_commit' => 'handlerCommit',
175
+ 'Handler_rollback' => 'handlerRollback',
176
+ 'Handler_savepoint' => 'handlerSavepoint',
177
+ 'Handler_savepoint_rollback' => 'handlerSavepointRollback'
176
178
  },
177
179
  'innodb' => {
178
- 'Innodb_buffer_pool_pages_total' => 'bufferTotal_pages',
179
- 'Innodb_buffer_pool_pages_free' => 'bufferFree_pages',
180
- 'Innodb_buffer_pool_pages_dirty' => 'bufferDirty_pages',
181
- 'Innodb_buffer_pool_pages_data' => 'bufferUsed_pages',
182
- 'Innodb_page_size' => 'pageSize',
183
- 'Innodb_pages_created' => 'pagesCreated',
184
- 'Innodb_pages_read' => 'pagesRead',
185
- 'Innodb_pages_written' => 'pagesWritten',
186
- 'Innodb_row_lock_current_waits' => 'currentLockWaits',
187
- 'Innodb_row_lock_waits' => 'lockWaitTimes',
188
- 'Innodb_row_lock_time' => 'rowLockTime',
189
- 'Innodb_data_reads' => 'fileReads',
190
- 'Innodb_data_writes' => 'fileWrites',
191
- 'Innodb_data_fsyncs' => 'fileFsyncs',
192
- 'Innodb_log_writes' => 'logWrites',
193
- 'Innodb_rows_updated' => 'rowsUpdated',
194
- 'Innodb_rows_read' => 'rowsRead',
195
- 'Innodb_rows_deleted' => 'rowsDeleted',
196
- 'Innodb_rows_inserted' => 'rowsInserted',
180
+ 'Innodb_buffer_pool_pages_total' => 'bufferTotal_pages',
181
+ 'Innodb_buffer_pool_pages_free' => 'bufferFree_pages',
182
+ 'Innodb_buffer_pool_pages_dirty' => 'bufferDirty_pages',
183
+ 'Innodb_buffer_pool_pages_data' => 'bufferUsed_pages',
184
+ 'Innodb_page_size' => 'pageSize',
185
+ 'Innodb_pages_created' => 'pagesCreated',
186
+ 'Innodb_pages_read' => 'pagesRead',
187
+ 'Innodb_pages_written' => 'pagesWritten',
188
+ 'Innodb_row_lock_current_waits' => 'currentLockWaits',
189
+ 'Innodb_row_lock_waits' => 'lockWaitTimes',
190
+ 'Innodb_row_lock_time' => 'rowLockTime',
191
+ 'Innodb_data_reads' => 'fileReads',
192
+ 'Innodb_data_writes' => 'fileWrites',
193
+ 'Innodb_data_fsyncs' => 'fileFsyncs',
194
+ 'Innodb_log_writes' => 'logWrites',
195
+ 'Innodb_rows_updated' => 'rowsUpdated',
196
+ 'Innodb_rows_read' => 'rowsRead',
197
+ 'Innodb_rows_deleted' => 'rowsDeleted',
198
+ 'Innodb_rows_inserted' => 'rowsInserted'
197
199
  },
198
200
  'configuration' => {
199
- 'max_connections' => 'MaxConnections',
200
- 'Max_prepared_stmt_count' => 'MaxPreparedStmtCount',
201
- },
201
+ 'max_connections' => 'MaxConnections',
202
+ 'Max_prepared_stmt_count' => 'MaxPreparedStmtCount'
203
+ }
202
204
  }
203
205
  end
204
206
 
@@ -265,7 +267,7 @@ class MysqlGraphite < Sensu::Plugin::Metric::CLI::Graphite
265
267
  puts e.message
266
268
  end
267
269
 
268
- mysql.close if mysql
270
+ mysql&.close
269
271
  end
270
272
 
271
273
  ok
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Select Count Metrics
4
6
  #
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # metrics-mysql-processes
4
6
  #
@@ -98,7 +100,7 @@ class MetricsMySQLProcesses < Sensu::Plugin::Metric::CLI::Graphite
98
100
  {
99
101
  'user' => {},
100
102
  'database' => {},
101
- 'command' => {},
103
+ 'command' => {}
102
104
  }.each_value { |value| value.default = 0 }
103
105
  end
104
106
 
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Query Result Count Metric
4
6
  #
@@ -92,6 +94,6 @@ class MysqlQueryCountMetric < Sensu::Plugin::Metric::CLI::Graphite
92
94
  rescue StandardError => e
93
95
  critical e
94
96
  ensure
95
- db.close if db
97
+ db&.close
96
98
  end
97
99
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL metrics Plugin without mysql gem requirement
4
6
  # ===
@@ -160,112 +162,112 @@ class MetricsMySQLRaw < Sensu::Plugin::Metric::CLI::Graphite
160
162
  def metrics_hash
161
163
  metrics = {
162
164
  'general' => {
163
- 'Bytes_received' => 'rxBytes',
164
- 'Bytes_sent' => 'txBytes',
165
- 'Key_read_requests' => 'keyRead_requests',
166
- 'Key_reads' => 'keyReads',
167
- 'Key_write_requests' => 'keyWrite_requests',
168
- 'Key_writes' => 'keyWrites',
169
- 'Binlog_cache_use' => 'binlogCacheUse',
170
- 'Binlog_cache_disk_use' => 'binlogCacheDiskUse',
171
- 'Max_used_connections' => 'maxUsedConnections',
172
- 'Aborted_clients' => 'abortedClients',
173
- 'Aborted_connects' => 'abortedConnects',
174
- 'Threads_connected' => 'threadsConnected',
175
- 'Open_files' => 'openFiles',
176
- 'Open_tables' => 'openTables',
177
- 'Opened_tables' => 'openedTables',
178
- 'Prepared_stmt_count' => 'preparedStmtCount',
179
- 'Seconds_Behind_Master' => 'slaveLag',
180
- 'Select_full_join' => 'fullJoins',
165
+ 'Bytes_received' => 'rxBytes',
166
+ 'Bytes_sent' => 'txBytes',
167
+ 'Key_read_requests' => 'keyRead_requests',
168
+ 'Key_reads' => 'keyReads',
169
+ 'Key_write_requests' => 'keyWrite_requests',
170
+ 'Key_writes' => 'keyWrites',
171
+ 'Binlog_cache_use' => 'binlogCacheUse',
172
+ 'Binlog_cache_disk_use' => 'binlogCacheDiskUse',
173
+ 'Max_used_connections' => 'maxUsedConnections',
174
+ 'Aborted_clients' => 'abortedClients',
175
+ 'Aborted_connects' => 'abortedConnects',
176
+ 'Threads_connected' => 'threadsConnected',
177
+ 'Open_files' => 'openFiles',
178
+ 'Open_tables' => 'openTables',
179
+ 'Opened_tables' => 'openedTables',
180
+ 'Prepared_stmt_count' => 'preparedStmtCount',
181
+ 'Seconds_Behind_Master' => 'slaveLag',
182
+ 'Select_full_join' => 'fullJoins',
181
183
  'Select_full_range_join' => 'fullRangeJoins',
182
- 'Select_range' => 'selectRange',
183
- 'Select_range_check' => 'selectRange_check',
184
- 'Select_scan' => 'selectScan',
185
- 'Slow_queries' => 'slowQueries',
184
+ 'Select_range' => 'selectRange',
185
+ 'Select_range_check' => 'selectRange_check',
186
+ 'Select_scan' => 'selectScan',
187
+ 'Slow_queries' => 'slowQueries'
186
188
  },
187
189
  'querycache' => {
188
- 'Qcache_queries_in_cache' => 'queriesInCache',
189
- 'Qcache_hits' => 'cacheHits',
190
- 'Qcache_inserts' => 'inserts',
191
- 'Qcache_not_cached' => 'notCached',
192
- 'Qcache_lowmem_prunes' => 'lowMemPrunes',
193
- 'Qcache_free_memory' => 'freeMemory',
190
+ 'Qcache_queries_in_cache' => 'queriesInCache',
191
+ 'Qcache_hits' => 'cacheHits',
192
+ 'Qcache_inserts' => 'inserts',
193
+ 'Qcache_not_cached' => 'notCached',
194
+ 'Qcache_lowmem_prunes' => 'lowMemPrunes',
195
+ 'Qcache_free_memory' => 'freeMemory'
194
196
  },
195
197
  'commands' => {
196
198
  'Com_admin_commands' => 'admin_commands',
197
- 'Com_begin' => 'begin',
198
- 'Com_change_db' => 'change_db',
199
- 'Com_commit' => 'commit',
200
- 'Com_create_table' => 'create_table',
201
- 'Com_drop_table' => 'drop_table',
202
- 'Com_show_keys' => 'show_keys',
203
- 'Com_delete' => 'delete',
204
- 'Com_create_db' => 'create_db',
205
- 'Com_grant' => 'grant',
199
+ 'Com_begin' => 'begin',
200
+ 'Com_change_db' => 'change_db',
201
+ 'Com_commit' => 'commit',
202
+ 'Com_create_table' => 'create_table',
203
+ 'Com_drop_table' => 'drop_table',
204
+ 'Com_show_keys' => 'show_keys',
205
+ 'Com_delete' => 'delete',
206
+ 'Com_create_db' => 'create_db',
207
+ 'Com_grant' => 'grant',
206
208
  'Com_show_processlist' => 'show_processlist',
207
- 'Com_flush' => 'flush',
208
- 'Com_insert' => 'insert',
209
- 'Com_purge' => 'purge',
210
- 'Com_replace' => 'replace',
211
- 'Com_rollback' => 'rollback',
212
- 'Com_select' => 'select',
213
- 'Com_set_option' => 'set_option',
214
- 'Com_show_binlogs' => 'show_binlogs',
209
+ 'Com_flush' => 'flush',
210
+ 'Com_insert' => 'insert',
211
+ 'Com_purge' => 'purge',
212
+ 'Com_replace' => 'replace',
213
+ 'Com_rollback' => 'rollback',
214
+ 'Com_select' => 'select',
215
+ 'Com_set_option' => 'set_option',
216
+ 'Com_show_binlogs' => 'show_binlogs',
215
217
  'Com_show_databases' => 'show_databases',
216
- 'Com_show_fields' => 'show_fields',
217
- 'Com_show_status' => 'show_status',
218
- 'Com_show_tables' => 'show_tables',
218
+ 'Com_show_fields' => 'show_fields',
219
+ 'Com_show_status' => 'show_status',
220
+ 'Com_show_tables' => 'show_tables',
219
221
  'Com_show_variables' => 'show_variables',
220
- 'Com_update' => 'update',
221
- 'Com_drop_db' => 'drop_db',
222
- 'Com_revoke' => 'revoke',
223
- 'Com_drop_user' => 'drop_user',
224
- 'Com_show_grants' => 'show_grants',
225
- 'Com_lock_tables' => 'lock_tables',
222
+ 'Com_update' => 'update',
223
+ 'Com_drop_db' => 'drop_db',
224
+ 'Com_revoke' => 'revoke',
225
+ 'Com_drop_user' => 'drop_user',
226
+ 'Com_show_grants' => 'show_grants',
227
+ 'Com_lock_tables' => 'lock_tables',
226
228
  'Com_show_create_table' => 'show_create_table',
227
- 'Com_unlock_tables' => 'unlock_tables',
228
- 'Com_alter_table' => 'alter_table',
229
+ 'Com_unlock_tables' => 'unlock_tables',
230
+ 'Com_alter_table' => 'alter_table'
229
231
  },
230
232
  'counters' => {
231
- 'Handler_write' => 'handlerWrite',
232
- 'Handler_update' => 'handlerUpdate',
233
- 'Handler_delete' => 'handlerDelete',
234
- 'Handler_read_first' => 'handlerRead_first',
235
- 'Handler_read_key' => 'handlerRead_key',
236
- 'Handler_read_next' => 'handlerRead_next',
237
- 'Handler_read_prev' => 'handlerRead_prev',
238
- 'Handler_read_rnd' => 'handlerRead_rnd',
239
- 'Handler_read_rnd_next' => 'handlerRead_rnd_next',
240
- 'Handler_commit' => 'handlerCommit',
241
- 'Handler_rollback' => 'handlerRollback',
242
- 'Handler_savepoint' => 'handlerSavepoint',
243
- 'Handler_savepoint_rollback' => 'handlerSavepointRollback',
233
+ 'Handler_write' => 'handlerWrite',
234
+ 'Handler_update' => 'handlerUpdate',
235
+ 'Handler_delete' => 'handlerDelete',
236
+ 'Handler_read_first' => 'handlerRead_first',
237
+ 'Handler_read_key' => 'handlerRead_key',
238
+ 'Handler_read_next' => 'handlerRead_next',
239
+ 'Handler_read_prev' => 'handlerRead_prev',
240
+ 'Handler_read_rnd' => 'handlerRead_rnd',
241
+ 'Handler_read_rnd_next' => 'handlerRead_rnd_next',
242
+ 'Handler_commit' => 'handlerCommit',
243
+ 'Handler_rollback' => 'handlerRollback',
244
+ 'Handler_savepoint' => 'handlerSavepoint',
245
+ 'Handler_savepoint_rollback' => 'handlerSavepointRollback'
244
246
  },
245
247
  'innodb' => {
246
- 'Innodb_buffer_pool_pages_total' => 'bufferTotal_pages',
247
- 'Innodb_buffer_pool_pages_free' => 'bufferFree_pages',
248
- 'Innodb_buffer_pool_pages_dirty' => 'bufferDirty_pages',
249
- 'Innodb_buffer_pool_pages_data' => 'bufferUsed_pages',
250
- 'Innodb_page_size' => 'pageSize',
251
- 'Innodb_pages_created' => 'pagesCreated',
252
- 'Innodb_pages_read' => 'pagesRead',
253
- 'Innodb_pages_written' => 'pagesWritten',
254
- 'Innodb_row_lock_current_waits' => 'currentLockWaits',
255
- 'Innodb_row_lock_waits' => 'lockWaitTimes',
256
- 'Innodb_row_lock_time' => 'rowLockTime',
257
- 'Innodb_data_reads' => 'fileReads',
258
- 'Innodb_data_writes' => 'fileWrites',
259
- 'Innodb_data_fsyncs' => 'fileFsyncs',
260
- 'Innodb_log_writes' => 'logWrites',
261
- 'Innodb_rows_updated' => 'rowsUpdated',
262
- 'Innodb_rows_read' => 'rowsRead',
263
- 'Innodb_rows_deleted' => 'rowsDeleted',
264
- 'Innodb_rows_inserted' => 'rowsInserted',
248
+ 'Innodb_buffer_pool_pages_total' => 'bufferTotal_pages',
249
+ 'Innodb_buffer_pool_pages_free' => 'bufferFree_pages',
250
+ 'Innodb_buffer_pool_pages_dirty' => 'bufferDirty_pages',
251
+ 'Innodb_buffer_pool_pages_data' => 'bufferUsed_pages',
252
+ 'Innodb_page_size' => 'pageSize',
253
+ 'Innodb_pages_created' => 'pagesCreated',
254
+ 'Innodb_pages_read' => 'pagesRead',
255
+ 'Innodb_pages_written' => 'pagesWritten',
256
+ 'Innodb_row_lock_current_waits' => 'currentLockWaits',
257
+ 'Innodb_row_lock_waits' => 'lockWaitTimes',
258
+ 'Innodb_row_lock_time' => 'rowLockTime',
259
+ 'Innodb_data_reads' => 'fileReads',
260
+ 'Innodb_data_writes' => 'fileWrites',
261
+ 'Innodb_data_fsyncs' => 'fileFsyncs',
262
+ 'Innodb_log_writes' => 'logWrites',
263
+ 'Innodb_rows_updated' => 'rowsUpdated',
264
+ 'Innodb_rows_read' => 'rowsRead',
265
+ 'Innodb_rows_deleted' => 'rowsDeleted',
266
+ 'Innodb_rows_inserted' => 'rowsInserted'
265
267
  },
266
268
  'configuration' => {
267
- 'Max_prepared_stmt_count' => 'MaxPreparedStmtCount',
268
- },
269
+ 'Max_prepared_stmt_count' => 'MaxPreparedStmtCount'
270
+ }
269
271
  }
270
272
  metrics
271
273
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # MySQL Select Count Metric
4
6
  #
@@ -94,6 +96,6 @@ class MysqlQueryCountMetric < Sensu::Plugin::Metric::CLI::Graphite
94
96
  rescue StandardError => e
95
97
  critical "unhandled exception: #{e}"
96
98
  ensure
97
- db.close if db
99
+ db&.close
98
100
  end
99
101
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # Copyright 2014 Paulo Miguel Almeida Rodenas (paulo.ubuntu@gmail.com)
4
6
  #
@@ -52,7 +54,7 @@ class MysqlMetric < Sensu::Handler
52
54
  puts e.errno
53
55
  puts e.error
54
56
  ensure
55
- con.close if con
57
+ con&.close
56
58
  end
57
59
  end
58
60
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sensu-plugins-mysql/version'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SensuPluginsMySql
2
4
  module Version
3
5
  MAJOR = 3
4
- MINOR = 1
5
- PATCH = 1
6
+ MINOR = 2
7
+ PATCH = 0
6
8
 
7
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-05 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.2'
47
+ version: '4.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.2'
54
+ version: '4.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.7'
61
+ version: '2.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.7'
68
+ version: '2.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: codeclimate-test-reporter
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '12.3'
117
+ version: '13.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '12.3'
124
+ version: '13.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: redcarpet
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.51.0
159
+ version: 0.81.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.51.0
166
+ version: 0.81.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: yard
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -186,23 +186,23 @@ description: |-
186
186
  sending metrics to a MySQL database.
187
187
  email: "<sensu-users@googlegroups.com>"
188
188
  executables:
189
+ - check-mysql-replication-status.rb
189
190
  - metrics-mysql.rb
191
+ - check-mysql-threads.rb
190
192
  - metrics-mysql-query-result-count.rb
191
- - check-mysql-replication-status.rb
193
+ - check-mysql-connections.rb
192
194
  - check-mysql-innodb-lock.rb
195
+ - metrics-mysql-select-count.rb
196
+ - check-mysql-status.rb
197
+ - metrics-mysql-graphite.rb
198
+ - check-mysql-alive.rb
199
+ - metrics-mysql-processes.rb
200
+ - metrics-mysql-multiple-select-count.rb
193
201
  - metrics-mysql-raw.rb
194
- - check-mysql-connections.rb
195
202
  - check-mysql-select-count.rb
196
- - check-mysql-disk.rb
197
203
  - check-mysql-msr-replication-status.rb
198
- - metrics-mysql-processes.rb
199
- - check-mysql-status.rb
200
- - metrics-mysql-multiple-select-count.rb
201
204
  - check-mysql-query-result-count.rb
202
- - check-mysql-threads.rb
203
- - check-mysql-alive.rb
204
- - metrics-mysql-select-count.rb
205
- - metrics-mysql-graphite.rb
205
+ - check-mysql-disk.rb
206
206
  extensions: []
207
207
  extra_rdoc_files: []
208
208
  files:
@@ -254,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  - !ruby/object:Gem::Version
255
255
  version: '0'
256
256
  requirements: []
257
- rubygems_version: 3.0.3
257
+ rubygems_version: 3.0.8
258
258
  signing_key:
259
259
  specification_version: 4
260
260
  summary: Sensu plugins for MySql