PT-152 Added SHOW SLAVE HOST to pt-mysql-summary

This commit is contained in:
Carlos Salguero
2017-08-29 15:45:13 -03:00
parent 9e8725a4b7
commit 511c80389f
2 changed files with 25 additions and 0 deletions

View File

@@ -929,6 +929,10 @@ collect_mysql_users () {
$CMD_MYSQL $EXT_ARGV -ss -e 'SELECT COUNT(*), SUM(user=""), SUM(password=""), SUM(password NOT LIKE "*%") FROM mysql.user' 2>/dev/null
}
collect_mysql_show_slave_hosts () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'SHOW SLAVE HOSTS' 2>/dev/null
}
collect_master_logs_status () {
local master_logs_file="$1"
local master_status_file="$2"
@@ -1027,6 +1031,7 @@ collect_mysql_info () {
collect_mysqld_instances "$dir/mysql-variables" > "$dir/mysqld-instances"
collect_mysqld_executables "$dir/mysqld-instances" > "$dir/mysqld-executables"
collect_mysql_show_slave_hosts "$dir/mysql-slave-hosts" > "$dir/mysql-slave-hosts"
local binlog="$(get_var log_bin "$dir/mysql-variables")"
if [ "${binlog}" ]; then
@@ -2092,6 +2097,19 @@ section_mysqld () {
done < "$executables_file"
}
section_slave_hosts () {
local slave_hosts_file="$1"
[ -e "$slave_hosts_file" ] || return
section "Slave Hosts"
if [ -s "$slave_hosts_file" ]; then
cat "$slave_hosts_file"
else
echo "No slaves found"
fi
}
section_mysql_files () {
local variables_file="$1"
@@ -2192,6 +2210,8 @@ report_mysql_summary () {
section_mysqld "$dir/mysqld-executables" "$dir/mysql-variables"
section_slave_hosts "$dir/mysql-slave-hosts"
local user="$(get_var "pt-summary-internal-user" "$dir/mysql-variables")"
local port="$(get_var port "$dir/mysql-variables")"
local now="$(get_var "pt-summary-internal-now" "$dir/mysql-variables")"