Monitor MySql with Zabbix

How to configure the zabbix on the agent side to allow mysql data to populate in zabbix. Ssh to the server you want to monitor – the one with the zabbix agent installed on. Check that your zabbix_agent config file is including the path “/etc/zabbix/zabbix_agentd.d/”:

# nano /etc/zabbix/zabbix_agentd.conf

(you will find at almost the end of file:

Include =/etc/zabbix/zabbix_agentd.d/)

Check where your zabbix_mysql config is:

# nano /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf

Looks for this type of info…

UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'

If you’ll find it for example: HOME=/var/lib/zabbix then create that directory if it does not exist:

# mkdir /var/lib/zabbix

change to that directory and create/edit .my.cnf file:

# cd /var/lib/zabbix
# nano .my.cnf

add the following (assuming you have a user zabbix added with a password. Or, you can use any user as long as they have permissions:



Then save.

Restart mysql:

#systemctl restart mariadb.service

Restart zabbix agent:

#systemctl restart zabbix-agent.service

Now go to Monitoring – Latest Data to view mysql data.

Other Resources:

Install Zabbix agent on Ubuntu

For Ubuntu 16.04 LTS:

$ wget
$ sudo dpkg -i zabbix-release_3.0-1+xenial_all.deb
$ sudo apt update

For Ubuntu 14.04 LTS:

$ wget
$ sudo dpkg -i zabbix-release_3.0-1+trusty_all.deb
$ sudo apt-get update

Install Zabbix Agent

$ sudo apt-get install zabbix-agent

Edit Zabbix Agent Configuration

 $ sudo nano /etc/zabbix/zabbix_agentd.conf

After adding zabbix server ip in configuration file, now restart agent service using below command.

# /etc/init.d/zabbix-agent restart

To start and stop zabbix-agent service anytime use following commands.

# /etc/init.d/zabbix-agent start
# /etc/init.d/zabbix-agent stop