雪花在空中嬉戏着、飞舞着,它净化了世间的一切尘埃,送走了严冬的寂寞,它自由地来,潇洒地去,多少著名的诗词都赞美过它: "忽如一夜春风来,千树万树梨花开 ",多么俏丽呀! "瑞雪兆丰年 ",它还是丰收的预言家呢!
#!/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.
以上就是MySQL获取系统性能和状态代码。你活得不快乐的原因是:既无法忍受目前的状态,又没能力改变这一切,可以像只猪一样懒,却无法像只猪一样懒得心安理得。更多关于MySQL获取系统性能和状态代码请关注haodaima.com其它相关文章!