Skip to content

Commit 72e83ed

Browse files
author
Charles JUDITH
committed
Improve slave_running check
The current code only consider condition Slave_SQL_Running is yes and then send slave_running equal 1. We should consider both of condition are Slave_IO_Running and Slave_SQL_Running to set the value of slave_running metric.
1 parent d68aee1 commit 72e83ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ def fetch_mysql_slave_stats(conn):
398398
if 'delay' in row and row['delay'] != None:
399399
status['slave_lag'] = row['delay']
400400

401-
status['slave_running'] = 1 if slave_row['Slave_SQL_Running'] == 'Yes' else 0
402-
status['slave_stopped'] = 1 if slave_row['Slave_SQL_Running'] != 'Yes' else 0
401+
status['slave_running'] = 1 if slave_row['Slave_SQL_Running'] == 'Yes' and slave_row['Slave_IO_Running'] == 'Yes' else 0
402+
status['slave_stopped'] = 1 if slave_row['Slave_SQL_Running'] != 'Yes' and slave_row['Slave_IO_Running'] != 'Yes' else 0
403403
return status
404404

405405
def fetch_mysql_process_states(conn):

0 commit comments

Comments
 (0)