Munin Unable to Generate Mysql Stats

Munin plugin is known to have issues while generating Mysql graphs. The mysql graph remains empty due to a bug in the Perl library that causes the path to the mysqladmin to be lost.

The solution is to specify the path to mysqladmin in the /etc/munin/plugin-conf.d/cpanel.conf file. Edit the file

# nano /etc/munin/plugin-conf.d/cpanel.conf

and add the below line in the [mysql*] section

env.mysqladmin /usr/bin/mysqladmin

The mysql section should look like follows

[mysql*]
user root
group wheel
env.mysqladmin /usr/bin/mysqladmin

Restart the munin-nodeĀ  service and see if it works. If it doesn’t, it indicates munin cannot read the values of mysql variables i.e. the username/password of mysql.

In such a case, have munin read the Mysql password from the .my.cnf file directly which is residing under the /root directory. To achieve this, create a file say, /root/mysqlpass

# nano /root/mysqlpass

and add the following command

/usr/bin/mysqladmin -uroot -p`cat /root/.my.cnf | grep pass \
| sed s/pass// | sed s/=// | sed s/\"//g` $@

The sed command may look confusing but it just removes words and characters around the password.

Set executable permission on the file

# chmod 755 /root/mysqlpass

Now edit the /etc/munin/plugin-conf.d/cpanel.conf file again and replace

env.mysqladmin /usr/bin/mysqladmin

with

env.mysqladmin /root/mysqlpass

Once done, restart the munin-node service and munin will start generating the Mysql graphs

This entry was posted on Sunday, January 27th, 2013 and is filed under cPanel Management. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.