@cryptotaxi247 / netdata-1 / commits / 4cee34139

"mysql" module update

lgz committed Oct 14, 2017 at 19:38 UTC 4cee341399c6c07c3ea3725691a28122d1989550
1 file changed +26 -14
python.d/mysql.chart.py
+26 -14
@@ -2,7 +2,7 @@
2 # Description: MySQL netdata python.d module
3 # Author: Pawel Krupa (paulfantom)
4
5 -from base import MySQLService
5 +from bases.FrameworkServices.MySQLService import MySQLService
6
7 # default module values (can be overridden per job in `config`)
8 # update_every = 3
@@ -116,12 +116,14 @@ GLOBAL_STATS = [
116 'Connection_errors_select',
117 'Connection_errors_tcpwrap']
118
119 +
120 def slave_seconds(value):
121 try:
122 return int(value)
123 except (TypeError, ValueError):
124 return -1
125
126 +
127 def slave_running(value):
128 return 1 if value == 'Yes' else -1
129
@@ -248,7 +250,8 @@ CHARTS = {
250 ['Innodb_data_fsyncs', 'fsyncs', 'incremental']
251 ]},
252 'innodb_io_pending_ops': {
251 - 'options': [None, 'mysql InnoDB Pending I/O Operations', 'operations', 'innodb', 'mysql.innodb_io_pending_ops', 'line'],
253 + 'options': [None, 'mysql InnoDB Pending I/O Operations', 'operations', 'innodb',
254 + 'mysql.innodb_io_pending_ops', 'line'],
255 'lines': [
256 ['Innodb_data_pending_reads', 'reads', 'absolute'],
257 ['Innodb_data_pending_writes', 'writes', 'absolute', -1, 1],
@@ -274,7 +277,8 @@ CHARTS = {
277 ['Innodb_os_log_written', 'write', 'incremental', -1, 1024],
278 ]},
279 'innodb_cur_row_lock': {
277 - 'options': [None, 'mysql InnoDB Current Row Locks', 'operations', 'innodb', 'mysql.innodb_cur_row_lock', 'area'],
280 + 'options': [None, 'mysql InnoDB Current Row Locks', 'operations', 'innodb',
281 + 'mysql.innodb_cur_row_lock', 'area'],
282 'lines': [
283 ['Innodb_row_lock_current_waits', 'current_waits', 'absolute']
284 ]},
@@ -287,7 +291,8 @@ CHARTS = {
291 ['Innodb_rows_deleted', 'deleted', 'incremental', -1, 1],
292 ]},
293 'innodb_buffer_pool_pages': {
290 - 'options': [None, 'mysql InnoDB Buffer Pool Pages', 'pages', 'innodb', 'mysql.innodb_buffer_pool_pages', 'line'],
294 + 'options': [None, 'mysql InnoDB Buffer Pool Pages', 'pages', 'innodb',
295 + 'mysql.innodb_buffer_pool_pages', 'line'],
296 'lines': [
297 ['Innodb_buffer_pool_pages_data', 'data', 'absolute'],
298 ['Innodb_buffer_pool_pages_dirty', 'dirty', 'absolute', -1, 1],
@@ -303,20 +308,23 @@ CHARTS = {
308 ['Innodb_buffer_pool_bytes_dirty', 'dirty', 'absolute', -1, 1024 * 1024]
309 ]},
310 'innodb_buffer_pool_read_ahead': {
306 - 'options': [None, 'mysql InnoDB Buffer Pool Read Ahead', 'operations/s', 'innodb', 'mysql.innodb_buffer_pool_read_ahead', 'area'],
311 + 'options': [None, 'mysql InnoDB Buffer Pool Read Ahead', 'operations/s', 'innodb',
312 + 'mysql.innodb_buffer_pool_read_ahead', 'area'],
313 'lines': [
314 ['Innodb_buffer_pool_read_ahead', 'all', 'incremental'],
315 ['Innodb_buffer_pool_read_ahead_evicted', 'evicted', 'incremental', -1, 1],
316 ['Innodb_buffer_pool_read_ahead_rnd', 'random', 'incremental']
317 ]},
318 'innodb_buffer_pool_reqs': {
313 - 'options': [None, 'mysql InnoDB Buffer Pool Requests', 'requests/s', 'innodb', 'mysql.innodb_buffer_pool_reqs', 'area'],
319 + 'options': [None, 'mysql InnoDB Buffer Pool Requests', 'requests/s', 'innodb',
320 + 'mysql.innodb_buffer_pool_reqs', 'area'],
321 'lines': [
322 ['Innodb_buffer_pool_read_requests', 'reads', 'incremental'],
323 ['Innodb_buffer_pool_write_requests', 'writes', 'incremental', -1, 1]
324 ]},
325 'innodb_buffer_pool_ops': {
319 - 'options': [None, 'mysql InnoDB Buffer Pool Operations', 'operations/s', 'innodb', 'mysql.innodb_buffer_pool_ops', 'area'],
326 + 'options': [None, 'mysql InnoDB Buffer Pool Operations', 'operations/s', 'innodb',
327 + 'mysql.innodb_buffer_pool_ops', 'area'],
328 'lines': [
329 ['Innodb_buffer_pool_reads', 'disk reads', 'incremental'],
330 ['Innodb_buffer_pool_wait_free', 'wait free', 'incremental', -1, 1]
@@ -359,7 +367,8 @@ CHARTS = {
367 ['Key_write_requests', 'writes', 'incremental', -1, 1]
368 ]},
369 'key_disk_ops': {
362 - 'options': [None, 'mysql MyISAM Key Cache Disk Operations', 'operations/s', 'myisam', 'mysql.key_disk_ops', 'area'],
370 + 'options': [None, 'mysql MyISAM Key Cache Disk Operations', 'operations/s',
371 + 'myisam', 'mysql.key_disk_ops', 'area'],
372 'lines': [
373 ['Key_reads', 'reads', 'incremental'],
374 ['Key_writes', 'writes', 'incremental', -1, 1]
@@ -375,13 +384,15 @@ CHARTS = {
384 ['Opened_files', 'files', 'incremental']
385 ]},
386 'binlog_stmt_cache': {
378 - 'options': [None, 'mysql Binlog Statement Cache', 'statements/s', 'binlog', 'mysql.binlog_stmt_cache', 'line'],
387 + 'options': [None, 'mysql Binlog Statement Cache', 'statements/s', 'binlog',
388 + 'mysql.binlog_stmt_cache', 'line'],
389 'lines': [
390 ['Binlog_stmt_cache_disk_use', 'disk', 'incremental'],
391 ['Binlog_stmt_cache_use', 'all', 'incremental']
392 ]},
393 'connection_errors': {
384 - 'options': [None, 'mysql Connection Errors', 'connections/s', 'connections', 'mysql.connection_errors', 'line'],
394 + 'options': [None, 'mysql Connection Errors', 'connections/s', 'connections',
395 + 'mysql.connection_errors', 'line'],
396 'lines': [
397 ['Connection_errors_accept', 'accept', 'incremental'],
398 ['Connection_errors_internal', 'internal', 'incremental'],
@@ -416,7 +427,7 @@ class Service(MySQLService):
427 raw_data = self._get_raw_data(description=True)
428
429 if not raw_data:
419 - return None
430 + return None
431
432 to_netdata = dict()
433
@@ -426,14 +437,15 @@ class Service(MySQLService):
437 if key in global_status:
438 to_netdata[key] = global_status[key]
439 if 'Threads_created' in to_netdata and 'Connections' in to_netdata:
429 - to_netdata['Thread_cache_misses'] = round(int(to_netdata['Threads_created']) / float(to_netdata['Connections']) * 10000)
440 + to_netdata['Thread_cache_misses'] = round(int(to_netdata['Threads_created'])
441 + / float(to_netdata['Connections']) * 10000)
442
443 if 'slave_status' in raw_data:
444 if raw_data['slave_status'][0]:
445 slave_raw_data = dict(zip([e[0] for e in raw_data['slave_status'][1]], raw_data['slave_status'][0][0]))
434 - for key, function in SLAVE_STATS:
446 + for key, func in SLAVE_STATS:
447 if key in slave_raw_data:
436 - to_netdata[key] = function(slave_raw_data[key])
448 + to_netdata[key] = func(slave_raw_data[key])
449 else:
450 self.queries.pop('slave_status')
451