Mon 6 Aug 2007
How to get your MySQL Munin Graphs working
Posted by Michael Brandonisio under How To , PersonalDigg This Entry ,
Hello,
I run a few cPanel servers and run Munin as my resource monitor. At the time I wrote this the version included with cPanel was munin 1.24. Ever since I have installed the plugin from cPanel it would monitor MySQL upon first install and then stop if the server was reboot. Uninstalling and reinstalling would once again get Munin to monitor MySQL but having to uninstall and reinstall just for a reboot, just did not seem like something that you should have to do. After many months of on and off testing this is the fix I have come up with.
- Create a MySQL user with a password that is NOT granted privilege to any DB. Simply create the user.
- Create a file called /etc/munin/plugin-conf.d/munin-node
- In the file /etc/munin/plugin-conf.d/munin-node put this:
[mysql*]
user root
group wheel
env.mysqladmin /usr/bin/mysqladmin
env.mysqlopts -u [MySQL_usr] -p[MySQL_usrpassword] - Then Save. Where [MySQL_usr] is a valid MySQL user and [MySQL_usrpassword] is it’s password. Note that there is NO space between -p and the password. This is critical.
Now what about 30 minutes to an hour to allow the munin-node to gather enough info to have something to graph. Then go view your Munin graphs. All of your MySQL graphs should have something in them.
Sincerely,
Mike
November 26th, 2007 at 11:29 am
Thanks for the tips, Mike. Very handy.
For those following along at home, here’s how to do #1:
INSERT INTO user (Host, User, Password) VALUES(’localhost’, ‘munin’, PASSWORD(’munin’));
FLUSH PRIVILEGES;
November 26th, 2007 at 11:44 am
Hi Bill,
Your welcome and thank you for the input.
Mike
July 17th, 2008 at 12:35 pm
Thanks so much! Great info.
August 4th, 2008 at 2:57 pm
Although Bill’s method works, it’s not “The Right Way”. Instead one should use:
mysql> CREATE USER munin@localhost IDENTIFIED BY ‘munin’;
[raymond]
August 4th, 2008 at 3:35 pm
Hi Raymond,
Thank you for the correction. Just so other reads can follow the part that starts with ‘IDENTIFIED’ is the password part. If you need a hashed password then use:
CREATE USER munin@localhost IDENTIFIED BY PASSWORD ‘munin’;
Mike
August 6th, 2008 at 2:24 pm
MIke–
No what you have won’t work.
… IDENTIFIED BY ‘clear-text-password’
or
… IDENTIFIED BY PASSWORD ‘already-encrypted-sting’
To specify the password as the hashed value as returned by the PASSWORD() function, include the PASSWORD keyword. See Section 12.5.1.3, “GRANT Syntax”. http://dev.mysql.com/doc/refman/5.0/en/create-user.html
.r
August 6th, 2008 at 3:13 pm
Hi Raymond,
Thanks for catching that.
Mike