Skip to content

Mysql Innodb monitoring with nagios

Mysql Innodb monitoring with nagios published on No Comments on Mysql Innodb monitoring with nagios

I am building a full innodb nrpe plugin.

We ran into a problem, the status gets trunctated and we are unable to plot all the correct values.
A colleague pointed me to this link.
http://www.mysqlperformanceblog.com/2008/10/31/full-innodb-status/

Below is a small script to get the full innodb status file using the hack discussed in the link above.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mysql_port=3306;
 
#Get PID of mysql_d running on $mysql_port
mysql_pid=`pgrep -f "mysqld.*--port=$mysql_port "`;
 
#If no PID was found, no mysqld instance is running on $mysql_port
if  `test -z $mysql_pid`
then
        echo "ERROR: No Mysqld instance running on port $mysql_port"
        exit 2;
fi
# We look for the full INNODB status file as described in:
# http://www.mysqlperformanceblog.com/2008/10/31/full-innodb-status/
for i in `ls -l /proc/$mysql_pid/fd | grep deleted | grep tmp | awk '{print $9}'`;
        do
        if [ ${#innodb_status_file} == 0 ]
        then
        innodb_status_file=`grep -l "INNODB MONITOR OUTPUT" /proc/$mysql_pid/fd/$i` ;
        else
        break;
        fi
done;
# If we did not find the file
if [ ${#innodb_status_file} == 0 ]
then
        echo "ERROR: unable to find INNODB MONITOR file"
        exit 2;
fi
 
cat $innodb_status_file;

Today I found this project, I will test this out.
http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/