Munin Unable to Generate Mysql Stats
January 27, 2013 | Posted byMunin 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