Enable MySQL Monitoring in Zabbix (Linux)

There are more steps than just simply adding the MySQL template to a host to get mysql monitoring working. We have to add additional information to the zabbix_agentd.conf file. This file is located at /usr/local/etc/zabbix_agentd.conf.

  1. Add the following to the end of the /usr/local/etc/zabbix_agentd.conf file:
    • UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
    • UserParameter=mysql.version,mysql -V
  2. You will then need to create the directory /var/lib/zabbix:
    • mkdir /var/lib/zabbix
    • chown zabbix /var/lib/zabbix
    • chmod 700 /var/lib/zabbix
  3. Create a file called .my.cnf in /var/lib/zabbix and put in the following contents replacing $Mysql_Root_Password with the root password for mysql.


4.  Then properly restrict access to that file.

  1. chown zabbix /var/lib/zabbix/.my.cnfchmod 600 /var/lib/zabbix/.my.cnf
  2. You then need to restart the zabbix agent
  3. service zabbix_agentd restart

We hope you find this article informative. Please share it with your friends, colleagues, and on all your favorite social sites. Let us know what interests you, and we will write it. Don’t forget to leave a comment.

Leave a Reply