mysql_plugin: remove slave query if query returned no data
Ilya committed
Mar 9, 2017 at 16:31 UTC
9b08c45ee44e2e1e485b1e33dbabae15ea3504e9
1 file changed
+8
-6
python.d/mysql.chart.py
+8
-6
@@ -425,12 +425,14 @@ class Service(MySQLService):
425
if 'Threads_created' in to_netdata and 'Connections' in to_netdata:
426
to_netdata['Thread_cache_misses'] = round(int(to_netdata['Threads_created']) / float(to_netdata['Connections']) * 10000)
427
428
- if 'slave_status' in raw_data and raw_data['slave_status'][0]:
429
- slave_raw_data = dict(zip([e[0] for e in raw_data['slave_status'][1]], raw_data['slave_status'][0][0]))
430
-
431
- for key, function in SLAVE_STATS:
432
- if key in slave_raw_data:
433
- to_netdata[key] = function(slave_raw_data[key])
428
+ if 'slave_status' in raw_data:
429
+ if raw_data['slave_status'][0]:
430
+ slave_raw_data = dict(zip([e[0] for e in raw_data['slave_status'][1]], raw_data['slave_status'][0][0]))
431
+ for key, function in SLAVE_STATS:
432
+ if key in slave_raw_data:
433
+ to_netdata[key] = function(slave_raw_data[key])
434
+ else:
435
+ self.queries.pop('slave_status')
436
437
return to_netdata or None
438