Skip to content

Commit

Permalink
Improve slave_running check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Charles JUDITH committed May 21, 2018
1 parent d68aee1 commit 72e83ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ def fetch_mysql_slave_stats(conn):
if 'delay' in row and row['delay'] != None:
status['slave_lag'] = row['delay']

status['slave_running'] = 1 if slave_row['Slave_SQL_Running'] == 'Yes' else 0
status['slave_stopped'] = 1 if slave_row['Slave_SQL_Running'] != 'Yes' else 0
status['slave_running'] = 1 if slave_row['Slave_SQL_Running'] == 'Yes' and slave_row['Slave_IO_Running'] == 'Yes' else 0
status['slave_stopped'] = 1 if slave_row['Slave_SQL_Running'] != 'Yes' and slave_row['Slave_IO_Running'] != 'Yes' else 0
return status

def fetch_mysql_process_states(conn):
Expand Down

0 comments on commit 72e83ed

Please sign in to comment.