MySQL獲得體系機能和狀況代碼。本站提示廣大學習愛好者:(MySQL獲得體系機能和狀況代碼)文章只能為提供參考,不一定能成為您想要的結果。以下是MySQL獲得體系機能和狀況代碼正文
#!/bin/ksh
INTERVAL=5
PREFIX=$INTERVAL-sec-status
touch /tmp/running
RUNFILE=/tmp/running
my -e 'show global variables' >> mysql-variables
while test -e $RUNFILE; do
file=$(date +%F_%I)
sleep=$(date +%s.%N | awk "{print $INTERVAL - (\$1 % $INTERVAL)}")
sleep $sleep
ts="$(date +"TS %s.%N %F %T")"
loadavg="$(uptime)"
echo "$ts $loadavg" >> $PREFIX-${file}-status
my -e 'show global status' >> $PREFIX-${file}-status &
echo "$ts $loadavg" >> $PREFIX-${file}-innodbstatus
my -e 'show engine innodb status\G' >> $PREFIX-${file}-innodbstatus &
echo "$ts $loadavg" >> $PREFIX-${file}-processlist
my -e 'show full processlist\G' >> $PREFIX-${file}-processlist &
echo $ts
done
echo Exiting because $RUNFILE does not exist.