I’ve been busy setting up the Percona Nagios MySQL Plugins  but ran into an issue with the pmp-check-mysql-deleted-files plugin;

UNK could not list MySQL's open files

After a little debugging we tracked this down to a problem caused by running multiple instances of mysqld. This is something the script author (Baron Schwartz) mentions in his script “# TODO: We could auto-check every running instance, not just one.”. I’ve replaced the following line

local PROC_ID=$(_pidof mysqld | head -n1)


local PROC_ID=`ps aux | grep mysqld | grep -v mysqld_safe | grep $OPT_PORT | awk '{print $2}'`;

Note, this uses the MySQL port number supplied to the script to identify the correct MySQL instance. Probably a cleaner way to do this so I’ll think about updating this post with a better way in the future. Usual disclaimer applies; not properly tested, buyer beware, keep out of reach of children, may contain nuts etc.