mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-28 00:21:56 +00:00
pt-stalk now collects 1 minute of dmesg output preceding trigger event - 1349086
This commit is contained in:
10
bin/pt-stalk
10
bin/pt-stalk
@@ -779,6 +779,7 @@ CMD_STRACE="${CMD_STRACE:-"$(_which strace)"}"
|
|||||||
CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
|
CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
|
||||||
CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
|
CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
|
||||||
CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
|
CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
|
||||||
|
CMD_DMESG="${CMD_DMESG:-"$(_which dmesg)"}"
|
||||||
|
|
||||||
[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
|
[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
|
||||||
|
|
||||||
@@ -862,6 +863,14 @@ collect() {
|
|||||||
if [ "$CMD_SYSCTL" ]; then
|
if [ "$CMD_SYSCTL" ]; then
|
||||||
$CMD_SYSCTL -a >> "$d/$p-sysctl" &
|
$CMD_SYSCTL -a >> "$d/$p-sysctl" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# collect dmesg events from 60 seconds ago until present
|
||||||
|
if [ "$CMD_DMESG" ]; then
|
||||||
|
local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
|
||||||
|
local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
|
||||||
|
$CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
|
||||||
|
fi
|
||||||
|
|
||||||
local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
|
local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
|
||||||
if [ "$CMD_VMSTAT" ]; then
|
if [ "$CMD_VMSTAT" ]; then
|
||||||
$CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
|
$CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
|
||||||
@@ -876,6 +885,7 @@ collect() {
|
|||||||
$CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &
|
$CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
$CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &
|
$CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &
|
||||||
local mysqladmin_pid=$!
|
local mysqladmin_pid=$!
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@ CMD_STRACE="${CMD_STRACE:-"$(_which strace)"}"
|
|||||||
CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
|
CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
|
||||||
CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
|
CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
|
||||||
CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
|
CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
|
||||||
|
CMD_DMESG="${CMD_DMESG:-"$(_which dmesg)"}"
|
||||||
|
|
||||||
# Try to find command manually.
|
# Try to find command manually.
|
||||||
[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
|
[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
|
||||||
@@ -146,6 +147,14 @@ collect() {
|
|||||||
if [ "$CMD_SYSCTL" ]; then
|
if [ "$CMD_SYSCTL" ]; then
|
||||||
$CMD_SYSCTL -a >> "$d/$p-sysctl" &
|
$CMD_SYSCTL -a >> "$d/$p-sysctl" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# collect dmesg events from 60 seconds ago until present
|
||||||
|
if [ "$CMD_DMESG" ]; then
|
||||||
|
local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
|
||||||
|
local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
|
||||||
|
$CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
|
||||||
|
fi
|
||||||
|
|
||||||
local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
|
local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
|
||||||
if [ "$CMD_VMSTAT" ]; then
|
if [ "$CMD_VMSTAT" ]; then
|
||||||
$CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
|
$CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
|
||||||
|
Reference in New Issue
Block a user