pt-stalk

1、名词解释
Collect forensic data about MySQL when problems occur
在问题发生的时候采集现场数据
pt-stalk waits for a trigger condition to occur, then collects data to help diagnose problems. The tool is designed to run as a daemon with root privileges, so that you can diagnose intermittent problems that you cannot observe directly. You can also use it to execute a custom command, or to collect data on demand without waiting for the trigger to occur
 

在一定条件下触发,采集一些监控数据便于分析问题。运行该功能需要有root权限。可以作为一个实时采集的功能,也可以设置触发条件。

 

2、例子

[root@typhoeus79 mysql_5580]# pt-stalk --collect-tcpdump --function status --variable Threads_connected --threshold 1 -- --user=root --password='c0BsZjR57MgAGOk6IWZAMarVVg0' --socket=./tmp/mysql.sock 
Overwriting PID file /var/run/pt-stalk.pid because its PID (15881) is not running
2013_12_25_11_11_16 Starting /data1/guosong/bin/pt-tool/bin/pt-stalk --function=status --variable=Threads_connected --threshold=1 --match= --cycles=5 --interval=1 --iterations= --run-time=30 --sleep=300 --dest=/var/lib/pt-stalk --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid --plugin=
2013_12_25_11_11_53 Check results: status(Threads_connected)=2, matched=yes, cycles_true=1
2013_12_25_11_11_54 Check results: status(Threads_connected)=2, matched=yes, cycles_true=2
2013_12_25_11_11_55 Check results: status(Threads_connected)=2, matched=yes, cycles_true=3
2013_12_25_11_11_56 Check results: status(Threads_connected)=2, matched=yes, cycles_true=4
2013_12_25_11_11_57 Check results: status(Threads_connected)=2, matched=yes, cycles_true=5
2013_12_25_11_11_57 Collect 1 triggered
2013_12_25_11_11_57 Collect 1 PID 17396
2013_12_25_11_12_06 Collect 1 done
2013_12_25_11_12_06 Sleeping 300 seconds after collect

 

采集的数据放在--dest目录下,包含如下文件:

这些数据都是原始数据,我们可以根据这些来分析当时MySQL或者主机是否有异常

 

 http://www.orczhou.com/index.php/2012/06/mysql-troubleshooting-with-pt-stakl/

 

posted @ 2013-12-25 11:15  小郭学路  阅读(472)  评论(0编辑  收藏  举报