How to Add MySQL Monitoring on Zabbix

zabbix mysql monitoring

In this article, I will show how to add MySQL database monitoring on Zabbix. I have two Ubuntu Server 16.04 virtual machines. The first one has installed Zabbix Server 3.2 and the second VM has MySQL 5.7 database that should be monitored.


First of all, we need an installed Zabbix Agent on the VM with MySQL

Download Zabbix 3.2

$ wget

Installing Zabbix Agent

$ sudo dpkg -i zabbix-release_3.2-1+xenial_all.deb
$ sudo apt update
$ sudo dpkg -s zabbix-agent
$ sudo apt install zabbix-agent

Configuring Zabbix Agent

sudo vim /etc/zabbix/zabbix_agentd.conf 

Find in file Server and ServerActive parameters and set there your Zabbix server IP or domain name.


Restart Zabbix Agent

sudo systemctl restart zabbix-agent.service

And add it to autostart

sudo systemctl enable zabbix-agent.service

Now we have to add a new user to our MySQL database

$ mysql -u root -p
mysql> GRANT USAGE ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'pass';

Check if line exists in Zabbix Agent configuration file /etc/zabbix/zabbix_agentd.conf


Check if file /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf exists

$ ls -lah /etc/zabbix/zabbix_agentd.d/

Create directory that is in HOME variable

$ sudo mkdir /var/lib/zabbix

And create file /var/lib/zabbix/.my.cnf with configuration

user = zabbix
password = pass

Restarting Zabbix Agent

$ sudo service zabbix-agent restart

Configuring Zabbix Server

Now go to your Zabbix Server web interface. Click on 'Configuration', 'Hosts' and 'Create host'.

zabbix create host

Enter 'Host name' of your MySQL server. You can check it in console

$ hostname

Select the needed group and enter MySQL server IP address in 'Agent interfaces'. Click 'Add' on the bottom of the page

zabbix host configuration

Now go to 'Hosts' and click on host 'Name'

zabbix hosts

Click on 'Templates' menu

zabbix mysql template

Start typing 'mysql' in 'Link new templates' and select the 'Template App MySQL'. Press 'Add' and 'Update'

That's all. Now we can see MySQL bandwidth and MySQL operations in 'Monitoring' -> 'Graphs'.

zabbix mysql operations graph
zabbix mysql bandwidth graph

Zabbix Client is configured now and you can check operations and bandwidth graphs through Zabbix Server web interface. You can also use this configuration to check MariaDB databases or add any other templates for monitoring the health of server or its services.

1 thought on “How to Add MySQL Monitoring on Zabbix”... add one

  1. how we can add the Template App MySQL this template is not there i added template DB mysql but this is not working


Leave a Comment