WEB开发网
开发学院数据库MySQL MySQL获取系统性能和状态 阅读

MySQL获取系统性能和状态

 2013-07-30 15:25:01 来源:开发学院   
核心提示:#!/bin/ksh INTERVAL=5 PREFIX=$INTERVAL-sec-status touch /tmp/running RUNFILE=/tmp/running my -e 'show global variables' >> mysql-variables w

#!/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.  

Tags:MySQL 获取 性能

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接