Bastian Kuhn has started an awesome series of check_mk related posts on his blog, including a few where he leads through creating a plugin for mysql.
The plugin can monitor all variables visible in the mysql status output.
It’s great to see some more plugins being added to the check_mk exchange and this will surely be a very high profile one 🙂
I definitely had to give it a try and it’s working:
The only issue was I have systems that are quite publicly accessible, so most ways of passing a password to mysql would not just work for me[tm]. I didn’t wanna use anything visible a command line option or envvar. (Moreso, I found that $MY_PWD does not even work??)
I got a working result using the following changes to the agent plugin:
if pgrep mysql > /dev/null ; then
mysql --defaults-extra-file=/root/.my.cnf -e "show status;" -s 2>&1
and creating a file called /root/.my.cnf (mode 400) that contains
Once these changes were in use, I could see the agent output using netcat etc.
I created a etc/check_mk/conf.d/mysql.mk with the following options – but note I’m not a DBA so these are just things that looked reasonable to monitor.
mysql_status_vars = [
( "Innodb_os_log_pending_fsyncs", 5, 10),
( "Innodb_buffer_pool_pages_dirty", 20, 40),
( "Innodb_row_lock_current_waits", 5, 10),
( "Innodb_row_lock_time_avg", None, None),
( "Innodb_row_lock_time_max", None, None),
( "Created_tmp_files", None, None),
One downside of the current (tutorial!) implementation is that you can’t just specify values that need to be calculated. (% of free buffers or such). but you can just add specific sections for those in the check and let him know 🙂
Worst thing is that my Perf-o-Meters are still broken!