3

Take the following situation:

  • zabbixserver: httpd, mysql-server, zabbix 2.2.11 with local database
  • databaseserver: mysql-server
  • zabbixserver monitors the local mysql database correctly.
  • zabbixserver reports that mysql on the databaseserver is down, while it is up
  • zabbixserver reports for other services on the databaseserver work OK

I've done the following to get this working, following this guide. On the databaseserver the zabbix-agent is installed, which reports to the zabbixserver.

  • created zabbixuser with usage grants on all databases and flushed privileges
  • created /etc/zabbix/.my.cnf

The file /etc/zabbix/.my.cnf is ignored. If I put it in /etc/zabbix/zabbix_agentd.d it is used.

[mysql]
user=zabbixuser
password=123456
[mysqladmin]
user=zabbixuser
password=123456

This .my.cnf has two profiles: mysql and mysqladmin, but I don't see where these are linked and why I should use these. Restarting the zabbix-agent results in an error.

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

The /var/log/zabbix/zabbix_agentd.log reports this:

1077:20151125:170718.508 active check configuration 
update from [10.2.3.4:10051] started to fail 
(cannot connect to [[10.2.3.4]:10051]: [4] Interrupted system call)
mysqladmin: unknown variable 'USER=zabbixuser'
mysql: unknown variable 'USER=zabbixuser'

What is wrong with this configuration?

SPRBRN
  • 571
  • 4
  • 12
  • 28

1 Answers1

3

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

Diamond
  • 9,001
  • 3
  • 24
  • 38
  • Thanks. I changed the configuration like you suggested, but still it doesn't work. See the log report in my updated question. – SPRBRN Nov 25 '15 at 16:44
  • It's working with the mysql/mysqladmin config. It turned out to be that the password for the user was wrong. Many thanks for helping out. – SPRBRN Nov 26 '15 at 08:38
  • You are welcome. Glad that it helped. – Diamond Nov 26 '15 at 08:50