标签:else 观察 通过 问题 ror war val cpu process
另外设置–dest /u01/mysql选项到mysql目录之后,pt-stalk在清理超过期限的日志时,会暴力的将该目录下所有修改时间超过一定日期的文件全部删掉,因此在设置dest目录时必须慎重(如果设置最好是一个独立的目录,而不是跟mysql或者其他设置在同一个目录)。–dest默认值是查看pt-stalk的源码:
# Delete collect files which more than --retention-time days old. find "$dir" -warn -type f -mtime +$retention_time -exec rm -f ‘{}‘ \; |
function trg_plugin(){ current_slow=`mysql -uroot -pxxx -P5002 -S/opt/tmp/mysql5002.sock -e"show global status like ‘Slow_queries‘" -B -N|awk ‘{print $2}‘` current_timestamp=`date ‘+%s‘` #when first execute,the last_timestamp is empty if [ ! -e Slow_queries ];then echo "$current_timestamp $current_slow">Slow_queries echo "0" exit 0 fi last_timestamp=`cat Slow_queries|awk ‘{print $1}‘` last_slow=`cat Slow_queries|awk ‘{print $2}‘` echo "$current_timestamp $current_slow">Slow_queries let diff_timestamp=$current_timestamp-$last_timestamp let diff_slow=$current_slow-$last_slow #echo "$diff_timestamp $diff_slow" if [ $diff_timestamp -gt 11 ];then echo "0" else echo $diff_slow fi } |
pt-stalk --daemonize --function=slow_log_status.sh --variable=my_custemed_condition --cycles=1 --threshold=2 --interval=10 --socket=/opt/tmp/mysql5002.sock --verbose=3 |
标签:else 观察 通过 问题 ror war val cpu process
原文地址:http://www.cnblogs.com/moss_tan_jun/p/6232501.html