@@ -175,32 +175,86 @@ def metrics_hash
175
175
'Handler_savepoint_rollback' => 'handlerSavepointRollback' ,
176
176
} ,
177
177
'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' ,
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_buffer_pool_pages_flushed' => 'bufferFlushed_pages' ,
183
+ 'Innodb_buffer_pool_pages_misc' => 'bufferMisc_pages' ,
184
+ 'Innodb_buffer_pool_bytes_data' => 'bufferUsed_bytes' ,
185
+ 'Innodb_buffer_pool_bytes_dirty' => 'bufferDirty_bytes' ,
186
+ 'Innodb_buffer_pool_read_ahead_rnd' => 'bufferReadAheadRnd' ,
187
+ 'Innodb_buffer_pool_read_ahead' => 'bufferReadAhead' ,
188
+ 'Innodb_buffer_pool_read_ahead_evicted' => 'bufferReadAheadEvicted' ,
189
+ 'Innodb_buffer_pool_read_requests' => 'bufferReadRequests' ,
190
+ 'Innodb_buffer_pool_reads' => 'bufferReads' ,
191
+ 'Innodb_buffer_pool_wait_free' => 'bufferWaitFree' ,
192
+ 'Innodb_buffer_pool_write_requests' => 'bufferWriteRequests' ,
193
+ 'innodb_buffer_pool_size' => 'poolSize' ,
194
+ 'Innodb_page_size' => 'pageSize' ,
195
+ 'Innodb_pages_created' => 'pagesCreated' ,
196
+ 'Innodb_pages_read' => 'pagesRead' ,
197
+ 'Innodb_pages_written' => 'pagesWritten' ,
198
+ 'Innodb_row_lock_current_waits' => 'currentLockWaits' ,
199
+ 'Innodb_row_lock_waits' => 'lockWaitTimes' ,
200
+ 'Innodb_row_lock_time' => 'rowLockTime' ,
201
+ 'Innodb_data_reads' => 'fileReads' ,
202
+ 'Innodb_data_writes' => 'fileWrites' ,
203
+ 'Innodb_data_fsyncs' => 'fileFsyncs' ,
204
+ 'Innodb_log_writes' => 'logWrites' ,
205
+ 'Innodb_rows_updated' => 'rowsUpdated' ,
206
+ 'Innodb_rows_read' => 'rowsRead' ,
207
+ 'Innodb_rows_deleted' => 'rowsDeleted' ,
208
+ 'Innodb_rows_inserted' => 'rowsInserted' ,
197
209
} ,
198
210
'configuration' => {
199
211
'max_connections' => 'MaxConnections' ,
200
212
'Max_prepared_stmt_count' => 'MaxPreparedStmtCount' ,
201
213
} ,
214
+ 'cluster' => {
215
+ 'wsrep_last_committed' => 'last_committed' ,
216
+ 'wsrep_replicated' => 'replicated' ,
217
+ 'wsrep_replicated_bytes' => 'replicated_bytes' ,
218
+ 'wsrep_received' => 'received' ,
219
+ 'wsrep_received_bytes' => 'received_bytes' ,
220
+ 'wsrep_local_commits' => 'local_commits' ,
221
+ 'wsrep_local_cert_failures' => 'local_cert_failures' ,
222
+ 'wsrep_local_bf_aborts' => 'local_bf_aborts' ,
223
+ 'wsrep_local_replays' => 'local_replays' ,
224
+ 'wsrep_local_send_queue' => 'local_send_queue' ,
225
+ 'wsrep_local_send_queue_avg' => 'local_send_queue_avg' ,
226
+ 'wsrep_local_recv_queue' => 'local_recv_queue' ,
227
+ 'wsrep_local_recv_queue_avg' => 'local_recv_queue_avg' ,
228
+ 'wsrep_flow_control_paused' => 'flow_control_paused' ,
229
+ 'wsrep_flow_control_sent' => 'flow_control_sent' ,
230
+ 'wsrep_flow_control_recv' => 'flow_control_recv' ,
231
+ 'wsrep_cert_deps_distance' => 'cert_deps_distance' ,
232
+ 'wsrep_apply_oooe' => 'apply_oooe' ,
233
+ 'wsrep_apply_oool' => 'apply_oool' ,
234
+ 'wsrep_apply_window' => 'apply_window' ,
235
+ 'wsrep_commit_oooe' => 'commit_oooe' ,
236
+ 'wsrep_commit_oool' => 'commit_oool' ,
237
+ 'wsrep_commit_window' => 'commit_window' ,
238
+ 'wsrep_local_state' => 'local_state' ,
239
+ 'wsrep_cert_index_size' => 'cert_index_size' ,
240
+ 'wsrep_causal_reads' => 'causal_reads' ,
241
+ 'wsrep_cluster_conf_id' => 'cluster_conf_id' ,
242
+ 'wsrep_cluster_size' => 'cluster_size' ,
243
+ 'wsrep_local_index' => 'local_index' ,
244
+ 'wsrep_evs_repl_latency' => 'evs_repl_latency'
245
+ }
202
246
}
203
247
end
248
+
249
+ def fix_and_output_evs_repl_latency_data ( row , mysql_shorthostname , category )
250
+ # see https://github.com/codership/galera/issues/67 for documentation on field mappings
251
+ data = row [ 'Value' ] . split ( '/' )
252
+ output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .wsrep_evs_repl_latency_min" , data [ 0 ]
253
+ output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .wsrep_evs_repl_latency_avg" , data [ 1 ]
254
+ output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .wsrep_evs_repl_latency_max" , data [ 2 ]
255
+ output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .wsrep_evs_repl_latency_stddev" , data [ 3 ]
256
+ output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .wsrep_evs_repl_latency_samplesize" , data [ 4 ]
257
+ end
204
258
205
259
def run
206
260
# props to https://github.com/coredump/hoardd/blob/master/scripts-available/mysql.coffee
@@ -228,9 +282,15 @@ def run
228
282
end
229
283
230
284
results . each_hash do |row |
285
+ # special handling for wsrep_evs_repl_latency as this contains forward slash delimited data
286
+ fix_and_output_evs_repl_latency_data ( row ) if row [ 'Variable_name' ] == 'wsrep_evs_repl_latency'
231
287
metrics . each do |category , var_mapping |
232
288
if var_mapping . key? ( row [ 'Variable_name' ] )
233
- output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .#{ var_mapping [ row [ 'Variable_name' ] ] } " , row [ 'Value' ]
289
+ if row [ 'Variable_name' ] == 'wsrep_evs_repl_latency'
290
+ fix_and_output_evs_repl_latency_data ( row , mysql_shorthostname , category )
291
+ else
292
+ output "#{ config [ :scheme ] } .#{ mysql_shorthostname } .#{ category } .#{ var_mapping [ row [ 'Variable_name' ] ] } " , row [ 'Value' ]
293
+ end
234
294
end
235
295
end
236
296
end
0 commit comments