×


Zabbix error Invalid entry when restarting zabbix-agent - Fix it now

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.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve errors when while troubleshooting Zabbix issues.

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 [12334]: 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:

[mysqld]
user=username
password=userpass
[mysqladmin]
user=username
password=userpass

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:

HOME=/var/lib/zabbix

with

HOME=/etc/zabbix

4. Finally, we restart the agent by running the below command.

$ service zabbix-agent restart

This must resolve the error message.


[Need urgent assistance in fixing Zabbix errors? – We're available 24*7. ]


Conclusion

This article covers how to fix Zabbix error, an invalid entry when restarting the zabbix-agent which may appear when the configuration file is placed in the wrong path.

The problem is with the configurations:

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.

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 this Zabbix error:

1. 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

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

3. 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.

4. Finally restart the agent: $ service zabbix-agent restart