本站精选了一篇MySQL系统状态相关的编程文章,网友任奇伟根据主题投稿了本篇教程内容,涉及到MySQL、系统性能、系统状态、MySQL获取系统性能和状态相关内容,已被484网友关注,如果对知识点想更进一步了解可以在下方电子资料中获取。
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.