MySQLでInnoDBのバッファヒット率を計算する

#!/bin/sh
MYSQLCMD="mysql -uroot"


GLOBAL_STATUS=`echo "show global status;"| ${MYSQLCMD}`
Innodb_buffer_pool_read_requests=`echo "${GLOBAL_STATUS}" | grep Innodb_buffer_pool_read_requests | sed -e "s/\s\+/ /g" | cut -f2 -d" "`
Innodb_buffer_pool_reads=`echo "${GLOBAL_STATUS}" | grep Innodb_buffer_pool_reads | sed -e "s/\s\+/ /g" | cut -f2 -d" "`

echo "scale=10; r = ${Innodb_buffer_pool_reads} / ${Innodb_buffer_pool_read_requests}; rr=1-r; rr * 100;" | bc