PT-80 Collect replication slave information

This commit is contained in:
Carlos Salguero
2017-03-27 17:30:06 -03:00
parent 61c5ba4faa
commit be971eeee5
8 changed files with 148 additions and 13 deletions

View File

@@ -248,10 +248,12 @@ collect() {
(echo $ts; transactions) >>"$d/$p-transactions" &
fi
if [ "${mysql_version}" '>' "5.6" ] && [ $ps_instrumentation_enabled == "yes"]; then
if [ "${mysql_version}" '>' "5.6" ] && [ $ps_instrumentation_enabled == "yes" ]; then
ps_locks_transactions "$d/$p-ps-locks-transactions"
fi
slave_status "$d/$p-slave-status" "${mysql_version}"
curr_time=$(date +'%s')
done
log "Loop end: $(date +'TS %s.%N %F %T')"
@@ -428,6 +430,29 @@ ps_locks_transactions() {
}
slave_status() {
local outfile=$1
local mysql_version=$2
if [ "${mysql_version}" '<' "5.7" ]; then
local sql="SHOW SLAVE STATUS\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
else
local sql="SELECT * FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING(channel_name)\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
sql="SELECT * FROM replication_connection_status\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
sql="SELECT * FROM replication_applier_status JOIN replication_applier_status_by_coordinator USING(channel_name)\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
fi
}
# ###########################################################################
# End collect package
# ###########################################################################