Mon 6 Aug 2007
How to get your MySQL Munin Graphs working
Posted by jsupport-user1 under How To , PersonalDigg This Entry , [8] Comments
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
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;
Hi Bill,
Your welcome and thank you for the input.
Mike
Thanks so much! Great info.
Although Bill’s method works, it’s not “The Right Way”. Instead one should use:
mysql> CREATE USER munin@localhost IDENTIFIED BY ‘munin’;
[raymond]
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
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
Hi Raymond,
Thanks for catching that.
Mike
[…] http://www.mbrando.com/2007/08/06/how-to-get-your-mysql-munin-graphs-working/ […]