Graph MySQL in Munin

Munin by default probably doesn’t graph MySQL data. It might if you installed Debian’s default MySQL server. Since I’m using MySQL’s repo and installed version 5.7 on my server… Munin doesn’t detect on install and doesn’t monitor my MySQL server. The default setting reading /etc/mysql/debian.cnf file using MySQL user “debian-sys-maint” wouldn’t work.

First create a new MySQL user and grant permission “Process” and “Replication client” to *.*.

CREATE USER 'monitor'@'localhost' IDENTIFIED BY 'monitor123';
GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'monitor'@'localhost';

Edit /etc/munin/plugin-conf.d/munin-node file and locate [mysql*] section. Comment out the defaults and add access for the new MySQL user.


#user root
#env.mysqlopts --defaults-file=/etc/mysql/debian.cnf
#env.mysqluser debian-sys-maint
#env.mysqlconnection DBI:mysql:mysql;mysql_read_default_file=/etc/mysql/debian.cnf
env.mysqlconnection DBI:mysql:information_schema;host=;port=3306
env.mysqluser monitor
env.mysqlpassword monitor123

Downloaded new Munin plugin mysql_ perl file from here and put it as /usr/share/munin/plugins/mysqlX_.
(You may need to run dos2unix on mysqlX_ to fix some encoding issue.)

Go into /etc/munin/plugins folder and run following:

for v in mysql_bin_relay_log mysql_commands mysql_connections mysql_files_tables mysql_innodb_bpool mysql_innodb_bpool_act mysql_innodb_io mysql_innodb_io_pend mysql_innodb_log mysql_innodb_rows mysql_innodb_semaphores mysql_innodb_tnx mysql_myisam_indexes mysql_network_traffic mysql_qcache mysql_qcache_mem mysql_replication mysql_select_types mysql_slow mysql_sorts mysql_table_locks mysql_tmp_tables; do ln -s /usr/share/munin/plugins/mysqlX_ $v;done

This enables pretty much everything there is to monitor about MySQL. New graphs should show up shortly.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.