Compiled some common MySQL scripts that can be used for monitoring. Not regularly updated ...
Check Lock:
More check_lock.sh#!bin/bashwhile truedo mysql -u root -p123456_ -h < ~/script/check_lock.sql >> ~/script/html/' date + "%Y%m%d" ' w11.html sleep 1donemore check_lock.sql SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thread, r.trx_query waiting_query, b.trx_id blocking_trx_id, b.trx_mysql_thread_id blocking_ Thread, b.trx_query blocking_query,now () FROM information_schema.innodb_lock_waits w inner join information_schema.innodb_trx b on b.trx_id = w.blocking_trx_id inner join information_schema.innodb_trx r on r.trx_id = w.requesting_trx_id;
Check process
check_proc.sh #!/bin/bashwhile Truedo mysql-u root-p123456_ h < ~/script/check_proc.sql >> ~/script/html/pro C_ ' date + '%y%m%d%h '. HTML sleep 2donecat Check_proc.sql Select Now (), Id,user,host,db,command,time,state,info from Information_schema.processlist where command not in (' Sleep ', ' Binlog Dump ') and INFO not like '%information_schema.proces Slist% ';
This article is from the "just out of the shell of the Birds" blog, please be sure to keep this source http://qhd2004.blog.51cto.com/629417/1920342
MySQL Common script