Zabbix: MySQL service monitor - invalid entry when restarting zabbix-agent

Solution 1:

The problem with your configurations are:

  1. You are putting the .my.cnf file at the wrong place.

Zabix agent configuration file has prescribed format and parameters defined. If you may use Include option to load additional config files, be sure it follows the same format. The zabbix documentation states it clearly:

Starting from version 1.8.6 Zabbix agent daemon will not start up if invalid (not following parameter=value notation) or unknown parameter entry is present in configuration file.

So, in your case the .my.cnf file fails to load when you put it under /etc/zabbix/zabbix_agentd.d.

  • You are missing the part to configure userparameter_mysql.conf file properly.

To resolve the issues:

  • Move the .my.cnf file from /etc/zabbix/zabbix_agentd.d directory to /etc/zabbix. And also remove any Include entry to refere to the .my.cnf file (if there is any). The content of the file may look like this:
[mysqld]
user=username
password=userpass

[mysqladmin]
user=username
password=userpass

Please make sure that the user listed here exists and have the necessary permissions in mysql.

  • Edit /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf file: You need to replace HOME=/var/lib/zabbix with HOME=/etc/zabbix to point to the right file (should appear three times) as mentioned in the first line of the file.

  • Finally restart the agent: service zabbix-agent restart