An invalid entry when restarting zabbix-agent issue may appear when the configuration file is present in the wrong path.
Generally, this issue is experienced when there is a problem with the mysql configuration.
In this context, we shall look into method to resolve this Zabbix problem.
How to fix the error 'invalid entry when restarting zabbix-agent' ?
Recently, one of our customers approached us saying that the Zabbix server reports that MySQL on the database server is down, while it is up.
He informed us that the configuration files my.cnf is ignored when put in the path /etc/zabbix/.
However, when put in /etc/zabbix/zabbix_agentd.d it is used.
Also, he tried to restart the Zabbix agent.
Restarting the Zabbix-agent throws an error message as below:
Starting Zabbix agent: zabbix_agentd : invalid entry [[mysql]] (not following "parameter=value" notation) in config file [/etc/zabbix/zabbix_agentd.d//.my.cnf], line 1
Now let us see how our Support Experts resolved this error message.
1. First, we move the .my.cnf file from /etc/zabbix/zabbix_agentd.d directory to /etc/zabbix.
Also, we remove any Include entry to refer to the .my.cnf file (if there is any).
The content of the file may look like as shown below:
2. We also make sure that the user listed here exists and have the necessary permissions in MySQL.
Then we edit /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf file.
3. Here, in order to point to the right file we replace:
4. Finally, we restart the agent by running the below command.
$ service zabbix-agent restart
This must resolve the error message.