Posted in Administration, Coding, IT, Linux, Posts-EN, Small Notes on March 15th, 2011 by Robert Vojcik
Many users use innodb engine for their databases. It’s good to monitor status of mysql and one part of it is monitor status of InnoDb.
Simple way to monitor innodb is just use SHOW command
SHOW ENGINE INNODB STATUS;
If you have big system on very high load, it’s possible that long DEAD LOCK brake the output.
Mysql show only part of status and then cut other informations off. It’s not bad if you have realy big dead lock but it’s not good for your monitoring.
Another way to monitor status of INNODB is using files in /proc filesystem. Here is small script that read informations from this file.
You can modify this little for your system, add cut off dead lock part for examle.
#!/bin/bash
export LC_ALL=POSIX
## Check for MYSQL pid
MYSQLPID=`ps -U mysqld | grep mysqld | awk '{print $1}'`
cd /proc/$MYSQLPID/fd/
## Let find the file with innodb status
for i in `ls -l| grep delete| grep tmp| awk '{print $9}'` ; do
grep "INNODB MONITOR OUTPUT" ./$i 2>&1 > /dev/null
if [ $? == 0 ] ; then
file="$i"
fi
done
## Print innodb status
cat $file
Slovak posts
English posts