Making Munin work with Mysql on Debian

Easier than I thought (all stuff as SU or using SUDO):

First we need to install some Mysql-Munin perl libraries:

apt-get install libipc-sharelite-perl

Also some Perl stuff will be needed:

perl -MCPAN -eshell
install IPC::ShareLite

Next let's activate Munin Mysql plugin:

# Assuming you have already installed both munin & mysql
ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins

Create a user for a Mysql database (so Munin will be able to get stats as this user):

mysql> CREATE USER `munin` @`localhost` IDENTIFIED BY 'somepassword';
mysql> GRANT SUPER ON *.* TO `munin` @`localhost`;
mysql> FLUSH PRIVILEGES;

Edit /etc/munin/plugin-conf.d/munin-node file and find [mysql*] section:

[mysql*]
user root
env.mysqlopts --defaults-file=/etc/mysql/debian.cnf
env.mysqluser munin

Let's also disable WARN: MySQL InnoDB free tablespace information (in most cases it is not valid):

Create a file /etc/munin/plugin-conf.d/mysql_innodb and place following lines into it:

[mysql_innodb]
env.warning 0
env.critical 0

or if You don't need InnoDB part, just turn it off by removing the symlink:

rm /etc/munin/plugins/mysql_innodb

Restart both Apache & Munin:

/etc/init.d/apache2 restart
/etc/init.d/munin-node restart
su munin -c /usr/bin/munin-cron

Wait until charts regenerate and You're ready to go! Example (generated for the first time):

Categories: Hosting, Linux, Software

3 Comments

  1. Hi, thanks for help !

    I’d like to know if you had a solution, in fact, the mysql server is not localhost, it is a remote host, and I do not see how to configure munin graph that remote server.

    The servers are on the same network :)

    Thank you!

  2. Well basically you should do the same – you just specify in your munin.conf where are the particular servers you want to monitor.

  3. It sounds like they are asking how to monitor your database which is on a remote host relative to your munin-node. I’m not sure if the plugin can be configured to connect to a MySQL instance running on a remote host, but what you should probably be doing anyway is running munin-node on that remote host and simply configuring it there (since it would be localhost then).

    If that’s not possible, perhaps because you don’t have the rights to install munin on it, you’ll have to investigate the plugin’s options to tell it to connect to a MySQL server at a given address. I expect in this example it’s assumed localhost where anything explicit has been omitted.

Leave a Reply

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

*

Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑