Warning message for lagging slave
This commit is contained in:
parent
7d51d2f69e
commit
c8043c2965
1 changed files with 9 additions and 5 deletions
|
@ -547,12 +547,16 @@ sub get_replication_status {
|
||||||
my $slave_status = `$mysqlcmd $mysqllogin -Bse "show slave status\\G"`;
|
my $slave_status = `$mysqlcmd $mysqllogin -Bse "show slave status\\G"`;
|
||||||
my ($io_running) = ($slave_status =~ /slave_io_running\S*\s+(\S+)/i);
|
my ($io_running) = ($slave_status =~ /slave_io_running\S*\s+(\S+)/i);
|
||||||
my ($sql_running) = ($slave_status =~ /slave_sql_running\S*\s+(\S+)/i);
|
my ($sql_running) = ($slave_status =~ /slave_sql_running\S*\s+(\S+)/i);
|
||||||
|
my ($seconds_behind_master) = ($slave_status =~ /seconds_behind_master\S*\s+(\S+)/i);
|
||||||
if ($io_running eq 'Yes' && $sql_running eq 'Yes') {
|
if ($io_running eq 'Yes' && $sql_running eq 'Yes') {
|
||||||
if ($myvar{'read_only'} eq 'OFF') {
|
if ($myvar{'read_only'} eq 'OFF') {
|
||||||
badprint "This replication slave is running with the read_only option disabled.";
|
badprint "This replication slave is running with the read_only option disabled.";
|
||||||
} else {
|
} else {
|
||||||
goodprint "This replication slave is running with the read_only option enabled.";
|
goodprint "This replication slave is running with the read_only option enabled.";
|
||||||
}
|
}
|
||||||
|
if ($seconds_behind_master>0) {
|
||||||
|
badprint "This replication slave is lagging and slave has $seconds_behind_master second(s) behind master host.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue