How to Monitor MySQL using the new Zabbix Template App MySQL

On the host where we want to monitor the mysql server we need to create a mysql user account where we can use to access mysql to get the nessary stats.

Create a new user account named "zabbix" to be use by the zabbix agent to monitor mysql. Run below in command line

mysql -uroot -p<mysql root password goes here> -e"GRANT USAGE ON *.* TO 'zabbix'@'127.0.0.1' IDENTIFIED BY '123456'";
mysql -uroot -p<mysql root password goes here> -e"GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY '123456'";
mysql -uroot -p<mysql root password goes here> -e"flush privileges"
mysql -uzabbix -p123456 -e"status"

Next create a new /etc/zabbix/.my.cnf config file with the mysql login (created above) to be used by zabbix to connect to the mysql server for monitoring purpose.

[mysql]
user=zabbix
password=123456
[mysqladmin]
user=zabbix
password=123456

Your zabbix agent config file should already have the line "Include=/etc/zabbix/zabbix_agentd.d/" which will automatically load all config files under that folder by default (including the userparameter_mysql.conf file). If not then you will need to do the below to load the config file.

In the main zabbix config file include the below line to enable loading of the mysql file.

Include=/etc/zabbix/zabbix_agentd.d/

Restart the zabbix agent to load the new config file.

service zabbix-agent restart

 

Now on the zabbix server create a new host using the "Template App MySQL" template

Some further info on the .my.cnf MySQL config file @ https://www.zabbix.com/forum/showpost.php?p=137388&postcount=26