Skip to content

Commit 43faf7c

Browse files
committed
feat(percona) add percona metrics gathering
1 parent 69aafcf commit 43faf7c

File tree

2 files changed

+88
-22
lines changed

2 files changed

+88
-22
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44
This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
55

66
## [Unreleased]
7+
### Fixed
8+
- Align output scheme for `metrics-mysql-graphite.rb` and `metrics-mysql-processes.rb`
9+
- Make mysql_shorthostname compliant with graphite even if 127.0.0.1 is givent as hostname
10+
- include MR #111: Collect more innodb variables #111:
11+
- `metrics-mysql-graphite.rb`: collect more InnoDB variables. (@boutetnico)
12+
- include metrics gathering from `https://github.com/sensu-plugins/sensu-plugins-percona` in `metrics-mysql-graphite.rb` (there is no reason to run the gathering twice and no reasons to keep two code base)
713

814
## [3.2.0] - 2020-08-26
915
### Changed

bin/metrics-mysql-graphite.rb

Lines changed: 82 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -177,32 +177,86 @@ def metrics_hash
177177
'Handler_savepoint_rollback' => 'handlerSavepointRollback'
178178
},
179179
'innodb' => {
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'
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_buffer_pool_pages_flushed' => 'bufferFlushed_pages',
185+
'Innodb_buffer_pool_pages_misc' => 'bufferMisc_pages',
186+
'Innodb_buffer_pool_bytes_data' => 'bufferUsed_bytes',
187+
'Innodb_buffer_pool_bytes_dirty' => 'bufferDirty_bytes',
188+
'Innodb_buffer_pool_read_ahead_rnd' => 'bufferReadAheadRnd',
189+
'Innodb_buffer_pool_read_ahead' => 'bufferReadAhead',
190+
'Innodb_buffer_pool_read_ahead_evicted' => 'bufferReadAheadEvicted',
191+
'Innodb_buffer_pool_read_requests' => 'bufferReadRequests',
192+
'Innodb_buffer_pool_reads' => 'bufferReads',
193+
'Innodb_buffer_pool_wait_free' => 'bufferWaitFree',
194+
'Innodb_buffer_pool_write_requests' => 'bufferWriteRequests',
195+
'innodb_buffer_pool_size' => 'poolSize',
196+
'Innodb_page_size' => 'pageSize',
197+
'Innodb_pages_created' => 'pagesCreated',
198+
'Innodb_pages_read' => 'pagesRead',
199+
'Innodb_pages_written' => 'pagesWritten',
200+
'Innodb_row_lock_current_waits' => 'currentLockWaits',
201+
'Innodb_row_lock_waits' => 'lockWaitTimes',
202+
'Innodb_row_lock_time' => 'rowLockTime',
203+
'Innodb_data_reads' => 'fileReads',
204+
'Innodb_data_writes' => 'fileWrites',
205+
'Innodb_data_fsyncs' => 'fileFsyncs',
206+
'Innodb_log_writes' => 'logWrites',
207+
'Innodb_rows_updated' => 'rowsUpdated',
208+
'Innodb_rows_read' => 'rowsRead',
209+
'Innodb_rows_deleted' => 'rowsDeleted',
210+
'Innodb_rows_inserted' => 'rowsInserted',
199211
},
200212
'configuration' => {
201-
'max_connections' => 'MaxConnections',
202-
'Max_prepared_stmt_count' => 'MaxPreparedStmtCount'
213+
'max_connections' => 'MaxConnections',
214+
'Max_prepared_stmt_count' => 'MaxPreparedStmtCount',
215+
},
216+
'cluster' => {
217+
'wsrep_last_committed' => 'last_committed',
218+
'wsrep_replicated' => 'replicated',
219+
'wsrep_replicated_bytes' => 'replicated_bytes',
220+
'wsrep_received' => 'received',
221+
'wsrep_received_bytes' => 'received_bytes',
222+
'wsrep_local_commits' => 'local_commits',
223+
'wsrep_local_cert_failures' => 'local_cert_failures',
224+
'wsrep_local_bf_aborts' => 'local_bf_aborts',
225+
'wsrep_local_replays' => 'local_replays',
226+
'wsrep_local_send_queue' => 'local_send_queue',
227+
'wsrep_local_send_queue_avg' => 'local_send_queue_avg',
228+
'wsrep_local_recv_queue' => 'local_recv_queue',
229+
'wsrep_local_recv_queue_avg' => 'local_recv_queue_avg',
230+
'wsrep_flow_control_paused' => 'flow_control_paused',
231+
'wsrep_flow_control_sent' => 'flow_control_sent',
232+
'wsrep_flow_control_recv' => 'flow_control_recv',
233+
'wsrep_cert_deps_distance' => 'cert_deps_distance',
234+
'wsrep_apply_oooe' => 'apply_oooe',
235+
'wsrep_apply_oool' => 'apply_oool',
236+
'wsrep_apply_window' => 'apply_window',
237+
'wsrep_commit_oooe' => 'commit_oooe',
238+
'wsrep_commit_oool' => 'commit_oool',
239+
'wsrep_commit_window' => 'commit_window',
240+
'wsrep_local_state' => 'local_state',
241+
'wsrep_cert_index_size' => 'cert_index_size',
242+
'wsrep_causal_reads' => 'causal_reads',
243+
'wsrep_cluster_conf_id' => 'cluster_conf_id',
244+
'wsrep_cluster_size' => 'cluster_size',
245+
'wsrep_local_index' => 'local_index',
246+
'wsrep_evs_repl_latency' => 'evs_repl_latency'
203247
}
204248
}
205249
end
250+
251+
def fix_and_output_evs_repl_latency_data(row, mysql_shorthostname, category)
252+
# see https://github.com/codership/galera/issues/67 for documentation on field mappings
253+
data = row['Value'].split('/')
254+
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.wsrep_evs_repl_latency_min", data[0]
255+
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.wsrep_evs_repl_latency_avg", data[1]
256+
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.wsrep_evs_repl_latency_max", data[2]
257+
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.wsrep_evs_repl_latency_stddev", data[3]
258+
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.wsrep_evs_repl_latency_samplesize", data[4]
259+
end
206260

207261
def run
208262
# props to https://github.com/coredump/hoardd/blob/master/scripts-available/mysql.coffee
@@ -230,9 +284,15 @@ def run
230284
end
231285

232286
results.each_hash do |row|
287+
# special handling for wsrep_evs_repl_latency as this contains forward slash delimited data
288+
fix_and_output_evs_repl_latency_data(row) if row['Variable_name'] == 'wsrep_evs_repl_latency'
233289
metrics.each do |category, var_mapping|
234290
if var_mapping.key?(row['Variable_name'])
235-
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.#{var_mapping[row['Variable_name']]}", row['Value']
291+
if row['Variable_name'] == 'wsrep_evs_repl_latency'
292+
fix_and_output_evs_repl_latency_data(row, mysql_shorthostname, category)
293+
else
294+
output "#{config[:scheme]}.#{mysql_shorthostname}.#{category}.#{var_mapping[row['Variable_name']]}", row['Value']
295+
end
236296
end
237297
end
238298
end

0 commit comments

Comments
 (0)