mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
PT-80 Moved function to the collect module
This commit is contained in:
42
bin/pt-stalk
42
bin/pt-stalk
@@ -1064,6 +1064,27 @@ tokudb_status() {
|
|||||||
>> "$d/$p-tokudbstatus$n" || rm -f "$d/$p-tokudbstatus$n"
|
>> "$d/$p-tokudbstatus$n" || rm -f "$d/$p-tokudbstatus$n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
innodb_status() {
|
||||||
|
local n=$1
|
||||||
|
|
||||||
|
local innostat=""
|
||||||
|
|
||||||
|
$CMD_MYSQL $EXT_ARGV -e "SHOW /*!40100 ENGINE*/ INNODB STATUS\G" \
|
||||||
|
>> "$d/$p-innodbstatus$n"
|
||||||
|
grep "END OF INNODB" "$d/$p-innodbstatus$n" >/dev/null || {
|
||||||
|
if [ -d /proc -a -d /proc/$mysqld_pid ]; then
|
||||||
|
for fd in /proc/$mysqld_pid/fd/*; do
|
||||||
|
file $fd | grep deleted >/dev/null && {
|
||||||
|
grep 'INNODB' $fd >/dev/null && {
|
||||||
|
cat $fd > "$d/$p-innodbstatus$n"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
slave_status() {
|
slave_status() {
|
||||||
local outfile=$1
|
local outfile=$1
|
||||||
local mysql_version=$2
|
local mysql_version=$2
|
||||||
@@ -1096,27 +1117,6 @@ slave_status() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
innodb_status() {
|
|
||||||
local n=$1
|
|
||||||
|
|
||||||
local innostat=""
|
|
||||||
|
|
||||||
$CMD_MYSQL $EXT_ARGV -e "SHOW /*!40100 ENGINE*/ INNODB STATUS\G" \
|
|
||||||
>> "$d/$p-innodbstatus$n"
|
|
||||||
grep "END OF INNODB" "$d/$p-innodbstatus$n" >/dev/null || {
|
|
||||||
if [ -d /proc -a -d /proc/$mysqld_pid ]; then
|
|
||||||
for fd in /proc/$mysqld_pid/fd/*; do
|
|
||||||
file $fd | grep deleted >/dev/null && {
|
|
||||||
grep 'INNODB' $fd >/dev/null && {
|
|
||||||
cat $fd > "$d/$p-innodbstatus$n"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# End collect package
|
# End collect package
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
@@ -102,6 +102,8 @@ collect() {
|
|||||||
log "Could not find the MySQL error log"
|
log "Could not find the MySQL error log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
slave_status "$d/$p-slave-status" $mysql_version
|
||||||
|
|
||||||
# Get a sample of these right away, so we can get these without interaction
|
# Get a sample of these right away, so we can get these without interaction
|
||||||
# with the other commands we're about to run.
|
# with the other commands we're about to run.
|
||||||
if [ "${mysql_version}" '>' "5.1" ]; then
|
if [ "${mysql_version}" '>' "5.1" ]; then
|
||||||
@@ -389,6 +391,38 @@ innodb_status() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slave_status() {
|
||||||
|
local outfile=$1
|
||||||
|
local mysql_version=$2
|
||||||
|
|
||||||
|
if [ "${mysql_version}" '<' "5.7" ]; then
|
||||||
|
echo "MySQL < 5.7 detected"
|
||||||
|
local status="SHOW SLAVE STATUS\G"
|
||||||
|
$CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile
|
||||||
|
else
|
||||||
|
local status="
|
||||||
|
SELECT *
|
||||||
|
FROM performance_schema.replication_connection_configuration
|
||||||
|
JOIN performance_schema.replication_applier_configuration
|
||||||
|
USING (channel_name)\G"
|
||||||
|
echo -e "\n$status\n" >> $outfile
|
||||||
|
$CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile
|
||||||
|
|
||||||
|
local status="SELECT *
|
||||||
|
FROM replication_connection_status\G"
|
||||||
|
echo -e "\n$status\n" >> $outfile
|
||||||
|
$CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile
|
||||||
|
|
||||||
|
local status="SELECT *
|
||||||
|
FROM replication_applier_status
|
||||||
|
JOIN replication_applier_status_by_coordinator
|
||||||
|
USING (channel_name)\G"
|
||||||
|
echo -e "\n$status\n" >> $outfile
|
||||||
|
$CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# End collect package
|
# End collect package
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
Reference in New Issue
Block a user