So while you were drinking beers before attending the FOSDEM I thought I would write a HOWTO
Easy one :
- First, install mysql collectd module :
yum install -y collectd-mysql
- Next create the configuration file :
nano /etc/e-smith/templates-custom/etc/collectd.d/mysql.conf/10base
Add the following :
LoadPlugin "mysql"
<Plugin "mysql">
<Database "databasetobemonitored">
Host "localhost"
Socket "/var/lib/mysql/mysql.sock"
User "collectd"
Password "chooseapassword"
</Database>
- Next create an collectd sql user, give it a password and give it access to the databases :
launch mysql and enter the following commands (as per the doc)
CREATE USER 'collectd'@'localhost' IDENTIFIED BY 'yourchoosenpassword';
-- Give appropriate permissions
-- ("GRANT USAGE" is synonymous to "no privileges")
GRANT USAGE ON *.* TO 'collectd'@'localhost';
-- Permissions for the MasterStats and SlaveStats options
GRANT REPLICATION CLIENT ON *.* TO 'collectd'@'localhost';
- Finally expand the template and restart collectd :
expand-template /etc/e-smith/templates-custom/etc/collectd.d/mysql.conf/
systemctl restart collectd
- Enjoy