Zabbix: user parameter mysql.status[*] – setting HOME

SPRBRN asked:

When I add the MySQL template to a host in Zabbix, it always reports an issue that the MySQL Service is down, while it is not.

I’ve created a new item for one host (the Zabbix server itself which runs its own MySQL server) to test an ODBC connection to MySQL. That works. The next step is to solve the issue “MySQL is down”.

  • Open the host configuration (in this case the Zabbix server / localhost)
  • Open items
  • Click one of the MySQL items, like: MySQL slow queries
  • The description field says: It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf. This is the same for all MySQL items.

I open /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf, and there it says:

# For all the following commands HOME should be set to the directory that has .my.cnf file with password information.

# Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert].
# Key syntax is mysql.status[variable].
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'

There is no .my.cnf file anywhere on this Amazon Linux system, but there is /etc/my.cnf. Then what is the HOME path? Or is it /var/lib/mysql instead of /var/lib/zabbix (which does not exist)? I’ve tried that but that doesn’t work.

My answer:

You need to create a .my.cnf file in Zabbix’s home directory which has Zabbix’s MySQL credentials.


You should have previously created a user for Zabbix.

GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY 'Whatever';

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.