Here are the steps:
1) Install 2 pre-requisite Perl modules for munin-mysql: IPC-ShareLite and Cache-Cache
2) git clone http://github.com/kjellm/munin-mysql
3) cd munin-mysql; edit Makefile and point PLUGIN_DIR to the directory where your munin plugins reside (if you installed Munin on Ubuntu via apt-get, that directory is /usr/share/munin/plugins)
4) make install --> this will copy the mysql_ Perl script to PLUGIN_DIR, and the mysql_.conf file to /etc/munin/plugin-conf.d
5) Edit /etc/munin/plugin-conf.d/mysql_.conf and customize it with your specific MySQL information.
For example, if you run 2 MySQL instances on ports 3306 and 3307, you could have something like this in mysql_.conf:
6) Run "/usr/share/munin/plugins/mysql_ suggest" to see what metrics are supported by the plugin. Then proceed to create symlinks in /etc/munin/plugins, adding the port number and the metric name as the suffix.
For example, to track InnoDB I/O metrics for the MySQL instance running on port 3306, you would create this symlink:
ln -s /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_3306_innodb_io
(replace 3306 with 3307 to track this metric for the other MySQL instance running on port 3307)
Of course, it's easy to automate this by a simple shell script.
7) Restart munin-node and wait 10-15 minutes for the munin master to receive the information about the new metrics.
Important! If you need to troubleshoot this plugin (and any Munin plugin), do not make the mistake of simply running the plugin script directly in the shell. If you do this, it will not read the configuration file(s) correctly, and it will most probably fail. Instead, what you need to do is to follow the "Debugging Munin plugins" documentation, and run the plugin through the munin-run utility. For example:
# munin-run mysql_3306_innodb_io
One more thing: you should probably automate all these above steps. I have most of it automated via a fabric script. The only thing I do by hand is to create the appropriate symlinks for the specific port numbers I have on each server.
That's it! Enjoy staring for hours at your brand new MySQL metrics!