Merge lp:~percona-toolkit-dev/percona-toolkit/pt-stalk-should-also-gather-dmesg-output-1349086 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.12

Proposed by Frank Cizmich
Status: Merged
Approved by: Daniel Nichter
Approved revision: 629
Merged at revision: 633
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/pt-stalk-should-also-gather-dmesg-output-1349086
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.12
Diff against target: 61 lines (+19/-0)
2 files modified
bin/pt-stalk (+10/-0)
lib/bash/collect.sh (+9/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-stalk-should-also-gather-dmesg-output-1349086
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+239256@code.launchpad.net

Description of the change

pt-stalk now gathers data from dmesg. It gathers from the last 60 seconds to keep the data relevant to the triggered event.

Note:
This proposal has been submitted before for 2.2.11 but was put on hold because changes were only made on pt-stalk and not made in lib/bash/collect.sh

To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Would be nice to test somehow? But I guess we don't test many of the various collections. So ok otherwise.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-stalk'
--- bin/pt-stalk 2014-09-25 13:48:22 +0000
+++ bin/pt-stalk 2014-10-22 18:33:46 +0000
@@ -779,6 +779,7 @@
779CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"779CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
780CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"780CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
781CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"781CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
782CMD_DMESG="${CMD_DMESG:-"$(_which dmesg)"}"
782783
783[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"784[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
784785
@@ -862,6 +863,14 @@
862 if [ "$CMD_SYSCTL" ]; then863 if [ "$CMD_SYSCTL" ]; then
863 $CMD_SYSCTL -a >> "$d/$p-sysctl" &864 $CMD_SYSCTL -a >> "$d/$p-sysctl" &
864 fi865 fi
866
867 # collect dmesg events from 60 seconds ago until present
868 if [ "$CMD_DMESG" ]; then
869 local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
870 local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
871 $CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
872 fi
873
865 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))874 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
866 if [ "$CMD_VMSTAT" ]; then875 if [ "$CMD_VMSTAT" ]; then
867 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &876 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
@@ -876,6 +885,7 @@
876 $CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &885 $CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &
877 fi886 fi
878887
888
879 $CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &889 $CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &
880 local mysqladmin_pid=$!890 local mysqladmin_pid=$!
881891
882892
=== modified file 'lib/bash/collect.sh'
--- lib/bash/collect.sh 2013-12-14 04:19:51 +0000
+++ lib/bash/collect.sh 2014-10-22 18:33:46 +0000
@@ -40,6 +40,7 @@
40CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"40CMD_SYSCTL="${CMD_SYSCTL:-"$(_which sysctl)"}"
41CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"41CMD_TCPDUMP="${CMD_TCPDUMP:-"$(_which tcpdump)"}"
42CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"42CMD_VMSTAT="${CMD_VMSTAT:-"$(_which vmstat)"}"
43CMD_DMESG="${CMD_DMESG:-"$(_which dmesg)"}"
4344
44# Try to find command manually.45# Try to find command manually.
45[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"46[ -z "$CMD_SYSCTL" -a -x "/sbin/sysctl" ] && CMD_SYSCTL="/sbin/sysctl"
@@ -146,6 +147,14 @@
146 if [ "$CMD_SYSCTL" ]; then147 if [ "$CMD_SYSCTL" ]; then
147 $CMD_SYSCTL -a >> "$d/$p-sysctl" &148 $CMD_SYSCTL -a >> "$d/$p-sysctl" &
148 fi149 fi
150
151 # collect dmesg events from 60 seconds ago until present
152 if [ "$CMD_DMESG" ]; then
153 local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
154 local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
155 $CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
156 fi
157
149 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))158 local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
150 if [ "$CMD_VMSTAT" ]; then159 if [ "$CMD_VMSTAT" ]; then
151 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &160 $CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &

Subscribers

People subscribed via source and target branches

to all changes: