MySQL获取系统性能和状态

页面导航:首页 > 数据库 > Mysql > MySQL获取系统性能和状态

MySQL获取系统性能和状态

来源: 作者: 时间:2016-02-18 10:28 【

MySQL获取系统性能和状态#!/bin/ksh INTERVAL=5 PREFIX=$INTERVAL-sec-status touch /tmp/running RUNFILE=/tmp/running my -e #39;show global variables#39; mysql-variables w...
MySQL获取系统性能和状态
 
#!/bin/ksh  
INTERVAL=5  
PREFIX=$INTERVAL-sec-status  
touch /tmp/running  
RUNFILE=/tmp/running  
my -e 'show global variables' >> -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:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<